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 (September 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Sep 2009 03:18:31 -0700
Reply-To:     Amar Mundankar <amarmundankar@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Amar Mundankar <amarmundankar@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: the last friday of each month
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Sep 11, 11:29 am, Michael <michae...@gmail.com> wrote: > Hi, > > Is there a way to write a function for the last friday of each month? > Thanks. > > Mike

Hi Mike, May be this can help. The following macro takes Year as input parameter and prints the Dates of Last Friday of every month for that particular year.

%macro LastFriday(year); data temp ; start_dt = "01Jan&year"d; end_dt = "31Dec&year"d;

do i = start_dt to end_dt; m = month(i); *-- 1-12 ; if weekday(i) = 6 then do; x = i; output; end; else continue; end; run;

proc sort data = temp out = temp2; by m; run;

data temp2; set temp; by m; if last.m; run;

proc print data = temp2 (keep = x); format x date9.; run; %mend;

%LastFriday(2009)

Regards, Amar.


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