Hello, I want to create a new macro variable (year+1) based on the macro year variable (2009-2012) and apply the new macro variable to the age calculation - that is, for 2009 data, the age calculation should be based the fiscal year end, that is March 2010, etc. Age = INT((INTCK('month', DOB,'31mar&year2.'d) - (DAY(DOB)>DAY('31mar&year2.'d)))/12); I thought it would work but it didn't; SAS didn't recognize the year2 variable. Here is the macro: %macro service_age (); %do year=2009 %to 2011; data list&year; merge dob_data (in=a) service&year (in=b); by id; if a and b; %let year2=1+&year; Age = INT((INTCK('month', DOB,'31mar&year2.'d) - (DAY(DOB)>DAY('31mar&year2.'d)))/12); run; %end; %mend service_age; %service_age; If I don't use macro, it'd look like the following: data list2009; merge dob_data (in=a) service2009 (in=b); by id; if a and b; Age = INT((INTCK('month', DOB,'31mar2010'd) - (DAY(DOB)>DAY('31mar2010'd)))/12); run; data list2010; merge dob_data (in=a) service2010 (in=b); by id; if a and b; Age = INT((INTCK('month', DOB,'31mar2011'd) - (DAY(DOB)>DAY('31mar2011'd)))/12); run; data list2011; merge dob_data (in=a) service2011 (in=b); by id; if a and b; Age = INT((INTCK('month', DOB,'31mar2012'd) - (DAY(DOB)>DAY('31mar2012'd)))/12); run; Thanks in advance for the help.
... View more