Could someone please help me with this problem. I am trying to create a macro variable in the format yymm using the following code- however the code seems to ignore the z format for the month portion of the code. I keep getting 162 instead of 1602 What am I missing here? Please advise.
%macro getdates (currdate);
%if %eval("&currdate"d > %sysfunc(intnx(week.6, %sysfunc(intnx(month, "&currdate"d,0,E)),0))) %then %do;
%let C_ME=%eval(%sysfunc(intnx(week.6, %sysfunc(intnx(month, "&currdate"d,1,E)),0)));
%end;
%else %do;
%let C_ME=%eval(%sysfunc(intnx(week.6, %sysfunc(intnx(month, "&currdate"d,0,E)),0)));
%end;
%put %sysfunc(putn(&C_ME,date9.));
%let mth=%sysfunc(cats(%substr(%sysfunc(putn(%sysfunc(year(&C_ME)),4.)),3,2),%sysfunc(putn(%sysfunc(month(&C_ME)),Z2.))));
%put &mth;
%mend;
%getdates(26Feb2016);
... View more