LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 1996, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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?
Comments: To: chwu@NONAME.AMERICAN.EDU
In-Reply-To:  <4ejkcq$>

>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.


Personally I would push for reporting number of days. The example below demonstrates why using month as the interval can be troublesome.



+*******************************************+ | 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: | +*******************************************+


data test;

start='01feb95'd; end='28feb95'd;


put 'number of months patient was hopialized='stay;



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.

Back to: Top of message | Previous page | Main SAS-L page