Date: Fri, 19 Jun 1998 12:58:45 -0400 Jack Shoemaker "SAS(r) Discussion" Jack Shoemaker Re: Time Calculation To: "khijjazi@vmsvax.simmons.edu"

Maybe this code fragment will help:

3 data test; 4 /* couple of dates */ 5 s = '15JAN1993'D; 6 e = '15MAR1993'D; 7 8 /* find start and end month */ 9 10 smon = intnx( 'month', s, 0 ); 11 emon = intnx( 'month', e, 0, 'E' ); 12 13 /* find number of month intervals */ 14 15 nmon = intck( 'month', s, e ) + 1; 16 17 /* do the deed */ 18 do i = 1 to nmon; 19 /* starting interval */ 20 if i = 1 then sint = s; 21 else sint = intnx( 'month', s, ( i - 1 ) ); 22 23 /* ending interval */ 24 if i = nmon then eint = e + 1; 25 else eint = intnx( 'month', s, i ); 26 27 ndays = eint - sint; 28 put sint= monyy7. ndays=; 29 end; 30 run;

SINT=JAN1993 NDAYS=17 SINT=FEB1993 NDAYS=28 SINT=MAR1993 NDAYS=15

-- Jack Shoemaker / Oxford Specialty Management / JShoemak@oxhp.com

+ -----Original Message----- + From: Kamal Hijjazi [mailto:khijjazi@VMSVAX.SIMMONS.EDU] + Sent: Friday, June 19, 1998 11:08 AM + To: SAS-L@UGA.CC.UGA.EDU + Subject: Time Calculation + + + Hello Friends: + I have a file that contains health services utilization over variable + lengths of time. Each of the records have a "START" and an "END" date. + The time lag between the start and end dates can be as little + as (1) day + or as long as (200) days. Using these date, I would like to create a + monthly summary (Jan thru Dec) in which the number of days between the + two dates will get proportioned into the appropriate months. For + example: + If the time period starts on Jan 15, 1993 and ends on March + 15 1993, the + output would be: + Jan=17 + Feb=28 + March=15 + And if the time period starts on Jan 15, 1993 and ends on Feb 15 1993, + the output would be: + Jan=17 + Feb=15 + And if the time period starts on Jan 15, 1993 and ends on Jan 16 1993, + the output would be: + Jan=2. + + I appreciate your help. + + Regards, + + Kamal Hijjazi + Assistant Professor + Simmons College + Boston, MA 02115 +

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