Below my code and attached is an excel document that contains the original SAS data set I am working with and the prints from my code. In my code I have created a macro that will create and print a new data set based on a starting year, ending year, and a month. The problem is that I want to be able to create multiple data sets at once by calling on more than one month at a time. So in my code were I am using: %getSnowMonths() %getSnowMonths(Month = Jan) %getSnowMonths(Month = Feb) to create a data set for Dec (default) Jan, and February by calling on my macro 3 times, I want to be able to use %getSnowMonths(Month = Dec Jan Feb) to create the same data sets and prints. This is actually a problem from a homework assignment I am working on (and having some trouble with) for a Master's class. Any suggestions or help would be appreciated. Thanks! %macro getSnowMonths(data = "/courses/u_rit.edu1/i_581369/c_1057/wk3/rochestersnowfalltab.txt", yearStart=1905, yearEnd=1930, Month = Dec, prefix=Snow); data snow; Infile &data Firstobs = 5 OBS = 122 DLM = '09'x; Input Season 4. Sep Oct Nov Dec Jan Feb Mar Apr May Total; If Sep = . then Sep = 0; If Oct = . then Oct = 0; If Nov = . then Nov = 0; If Apr = . then Apr = 0; If May = . then May = 0; Options errors = 1000; Run; data &prefix&month&yearStart&yearEnd; set snow; keep Season &Month; where Season >=&yearStart and Season <=&yearEnd; run; Proc print data = &prefix&month&yearStart&yearEnd NoObs label; label &Month = 'Snow'; Title "Rochester Snowfall in &Month"; Footnote "Created on &sysday %sysfunc(today(), mmddyy10.) at &systime."; run; %mend getSnowMonths; %getSnowMonths() %getSnowMonths(Month = Jan) %getSnowMonths(Month = Feb) options symbolgen mprint;
... View more