Date: Wed, 31 Jan 1996 09:25:26 -0500
Reply-To: Christopher Zogby <chris@PHOR.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Christopher Zogby <chris@PHOR.COM>
Organization: Pharmaceutical Outcomes Research, Inc.
Subject: Re: Counting the Months?
In-Reply-To: <4ejkcq$26p@crcnis3.unl.edu>
>I had a difficulty to calculate the number of months from two different
>dates. The first day indicates the entrance date of a patient and the
>second day is the recovery date. I want to figure out how long the
>patients stay in hospitals. Thanks for any response.
Try the intck function.
somevar=intck(interval,from,to);
Personally I would push for reporting number of days. The example below
demonstrates why using month as the interval can be troublesome.
Cheers,
Chris
+*******************************************+
| Christopher Zogby |
| SAS Programmer/Analyst |
| Pharmaceutical Outcomes Research, Inc. |
| 435 Lawrence Bell Drive |
| Williamsville, NY 14221 |
| Phone: (716) 633-3463 |
| Fax: (716) 633-7404 |
| e-mail: chris@phor.com |
+*******************************************+
__________________program_____________________________
data test;
start='01feb95'd;
end='28feb95'd;
stay=intck('month',start,end);
put 'number of months patient was hopialized='stay;
run;
_____________________log_______________________________
1 data test;
2
3 start='01feb95'd;
4 end='28feb95'd;
5
6
7 stay=intck('month',start,end);
8
9
10 put 'number of months patient was hopialized='stay;
11
12 run;
number of months patient was hopialized=0
NOTE: The data set WORK.TEST has 1 observations and 3 variables.