Date: Wed, 15 Jun 2005 22:59:00 -0400
Reply-To: Paul Pham <psquares@YAHOO.COM.AU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Pham <psquares@YAHOO.COM.AU>
Subject: Re: convert date to week
Yes I realised that I have made some modification to the validation dates
using the wrong start and end date for the weeks, thanks for pointing that
out. The program that I have posted earlier also gives me the correct
assigned week for the input dates and so does Ian and your program too.
Btw Ian's monweek macro uses the CATS function which is only available in
SAS version 9 onward, as I'm still a version 8.2 user I have to resort to
the ususal combinations of concatenation, trim and left function to do the
job.
Here it's
%macro monweek_v8 ( date
, key=3 /* Thursday */
) ;
%local keyday ;
%let keyday = (intnx("week.2", &date, 0, 'b') + &key) ;
TRIM(LEFT("week"))||TRIM(LEFT(int((day(&keyday)-1)/7) + 1))||TRIM
(LEFT("_"))||
TRIM(LEFT(put(&keyday,monyy5.)))
%mend monweek_v8 ;
Again a BIG thank you all for your helpful guidance and codes, may all
have a wonderful day.
Best Regards
Paul
|