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 (April 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 8 Apr 1996 23:35:52 GMT
Reply-To:   Bruce Kayton <bakayton@IX.NETCOM.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Bruce Kayton <bakayton@IX.NETCOM.COM>
Organization:   Pacific Bell
Subject:   Re: Week number calculation?

No ready to run function that I know of. Use the intck function to determine the number of intervals, weeks in this case, from the 1st day in the current year to today, the default in the macro, or to any date that you pass to the macro.

1 %macro week(date=today()); 2 year_beg=mdy(1,1,year(&date)); 3 week=intck('week',year_beg,&date)+1; /* intck(interval,from,to) 4 %mend; 5 6 data _null_; 7 %week; /* For current date in this case 4/8/96 */ 8 put week=; 9 %week(date='29feb96'd); /* For specified date. 2/29/96 */ 10 put week=; 11 run;

WEEK=15 WEEK=9

Remember that using the INTCK function on the first interval requested will return a zero, so just add 1.

Bruce Kayton


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