LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2009, 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 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


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