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 (September 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 22 Sep 2005 18:21:19 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: SAS Date Question

Generate the windows for each possible PRE_FILL in 2005 and examine them:

data days; do pre_fill = '01jan2005'd to '31dec2005'd; do study_fill = '01jan2004'd to '31dec2006'd; mon_diff= intck('month',pre_fill,study_fill)- (day(pre_fill) > day(study_fill) ); if 0 le mon_diff le 6 then output; end; end; format pre_fill study_fill date9.; run;

proc tabulate data=days; class pre_fill; var study_fill; table pre_fill, study_fill * ((min max)*f=date9. range*f=5.); run;

It appears that the windows are each 7 months, so you probably want to change LE 6 to LT 6 or LE 5.

The other issue with this kind of problem is the effect of the varying length of months. This is most noticeable for intervals which conclude near the end of February. The table here shows you that the windows for July 29, July 30, July 31, and August 1 all end on February 28. If that's OK, fine. Otherwise the code will need modification.

On Tue, 20 Sep 2005 11:02:09 -0400, Dave Hapeman <dave.hapeman@NDCHEALTH.COM> wrote:

>Greetings, > I want to make sure my thinking is correct. In a dataset I have two >SAS date variables. I want to see if the one is within six months of the >second. My code is this: > > mon_diff= intck('month',pre_fill,study_fill)-(day(pre_fill) > day >(study_fill));; > > if 0 le mon_diff le 6 then output; > > I wuld appreciate if the group would look at this to double check me. > >Thanks > >Dave


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