Creating adataset of the day, month, year of every day for next year

Creating adataset of the day, month, year of every day for next year

Post by matt_hutch » Wed, 28 Mar 2007 22:45:43


I want to incorporate an element into a resourcing program I am
writing that tells me how many mon thru fridays there are in any given
month in the future.

I will only ever need to know the next 12 months at any given time.
Obviously these vary due to the way w/e's fall and # of days in the
month.

Ideally I need an output dataset that gives me 365 rows giving day,
date, month, year for each day. Am assuing the starting point is the
today() function but not sure about the in between - any help out
there? am guessing its a macro thing?

thanks
Matt
 
 
 

Creating adataset of the day, month, year of every day for next year

Post by sbarr » Wed, 28 Mar 2007 23:32:07


Useful DATA step functions to consider would be INTCK, INTNX and
WEEKDAY. You may find that a SAS PROC FORMAT application might also
work well.

Sincerely,

Scott Barry
SBBWorks, Inc.

 
 
 

Creating adataset of the day, month, year of every day for next year

Post by chri » Wed, 28 Mar 2007 23:36:46


Hi Matt,

data dates;
do d = '01jan2008'd to '31dec2008'd;
weekday = weekday(d);
day = day(d);
month = month(d);
year = year(d);
etc...
output;
end;
run;

something like that. No need to delve into macros! Don't be afraid
to look up all the other date/time handling functions in the on-line
docs though - you'll learn something every time you look.

Chris.
--------------------------------------------------------
Elvis SAS Log Analyser - http://www.yqcomputer.com/
--------------------------------------------------------