Date: Tue, 10 Jun 2008 15:34:19 -0700
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: How to get the number of days between two dates
In-Reply-To: <29306269-5f76-4334-95ed-586ad63d4adf@8g2000hse.googlegroups.com>
Content-Type: text/plain; charset=iso-8859-1
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of cwgmath
> Sent: Tuesday, June 10, 2008 3:05 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: How to get the number of days between two dates
>
> I am working with a date set where I have an entry date and an exit
> date. I need to determine the number of days within those two dates.
> For example an entry date is 9/29/2000 and an exit date is
> 10/17/2000. Any help would be of great benefit. Thank you in advance
> for you assistance.
>
> Chris
>
Chris,
If your dates are stored as numeric SAS dates, it is as simple as
Days = exit_date - entry_date;
If your dates are held as character variables, then you just need to convert the variables to SAS dates using the input function.
Data want;
entry_date_c = '9/29/2000';
exit_date_c = '10/17/2000';
entry_date = input(entry_date_c,mmddyy10.);
exit_date = input(exit_date_c,mmddyy10.);
days = exit_date - entry_date;
Run;
Hope this is helpful,
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|