Chapter Contents

Previous

Next
DATDIF

DATDIF



Returns the number of days between two dates

Category: Date and Time


Syntax
Arguments
Examples
See Also

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=; 
put days360=;

6332
6240


See Also

Functions:

YRDIF


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.