DATDIF Function


DATDIF Function

Returns the number of days between two dates

Category: Date and Time

Syntax

DATDIF ( sdate , edate , basis )

Arguments

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'

Examples

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

See Also

Functions:

  • 'YRDIF Function' on page 916




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net