|
On Wed, 19 Nov 2003 12:14:02 -0500, Gerhard Hellriegel <ghellrieg@T-
ONLINE.DE> wrote:
>... the only problem might be: the results are negative. You can use the
>ABS function for that or flip the variables.
an alternative solution to that negative result problem could be :
diffday = range( datevar1, datepart( datevar2) );
>
>On Wed, 19 Nov 2003 08:55:26 -0600, Gary Ross <gary_ross@MGIC.COM> wrote:
>
>>Leslie Fisher wrote:
>>>
>>> Hi,
>>> I have a rather simple problem, but cannot get it done. I just want to
>>> compute the difference in days between two SAS date variables (DATEVAR1
>>> and DATEVAR2). SAS says, DATEVAR1 has ddmmyy9. and DATEVAR2 has
>>> DATETIME20. format.
>>> DATEVAR1 DATEVAR2 The result could look like DIFFDAY
>>> 24/11/97 25NOV1997:00:00:00 1
>>> 14/12/00 16DEC2000:00:00:00 2
>>> 17/02/00 21FEB2000:00:00:00 4
>>> 17/07/00 10DEC1999:00:00:00 etc.
>>> 29/09/00 09DEC1999:00:00:00
>>> ...
>>> Thanks a lot in advance,
>>> Leslie
>>
>>Leslie
>>
>>You need to apply the datepart function to the datetime variable like
>>
>>diffday = datevar1 - datepart(datevar2) ;
>>
>>HTH
|