Date: Mon, 8 Jun 2009 07:04:53 -0400
Reply-To: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Subject: Re: Help in finding last friday
Content-Type: text/plain; charset=ISO-8859-1
On Mon, 8 Jun 2009 15:57:20 +0530, Alex S <alex4sas@YAHOO.CO.IN> wrote:
>Hello All,
>�������� I want�to get�last friday date value. Whenever i run my code it
should get last friday date value. Could you please help me on this.
>
>Thanking� you in advance
>
>Regards
>alex .S.
Alex,
Find the first of each month and work backwards into the previous month
until you encounter a Friday.
data want( keep= LastFriday ) ;
do year=2001 to 2009 ;
do mon=1 to 12 ;
FirstOfMonth=mdy( mon, 1, year ) ;
do _n_=1 to 7 ;
LastFriday=FirstOfMonth-_n_ ;
if weekday( LastFriday )=6 /*Friday */ then do ;
output ;
leave ;
end ;
end;
end ;
end ;
format LastFriday date9. ;
stop ;
run ;
Regards,
Ken Borowiak
|