Returns the number of days between two dates
Category: Date and Time
DATDIF ( sdate , edate , basis )
sdate
specifies a SAS date value that identifies the starting date.
edate
specifies a SAS date value that identifies the ending date.
basis
identifies a character constant or variable that describes how SAS calculates the date difference. The following character strings are valid:
'30/360'
specifies a 30 day month and a 360 day year. Each month is considered to have 30 days, and each year 360 days, regardless of the actual number of days in each month or year.
Alias: '360'
Tip: If either date falls at the end of a month, SAS treats the date as if it were the last day of a 30-day month.
'ACT/ACT'
uses the actual number of days between dates.
Alias: 'Actual'
In the following example, DATDIF returns the actual number of days between two dates, and the number of days based on a 30-month and 360-day year.
data _null; sdate='16oct78'd; edate='16feb96'd; actual=datdif(sdate, edate, 'act/act'); days360=datdif(sdate, edate, '30/360'); put actual= days360=; run;
SAS Statements | Results |
---|---|
put actual=; | 6332 |
put days360=; | 6240 |
Functions:
'YRDIF Function' on page 916