The following macro returns date in monYY format. The output is having the month name in all caps e.g. DEC19 while the desired output is Dec19. What changes should be made to the macro to get the output in the required format.
Thanks in advance !
%macro iter(); data _null_; %do i = 1 %to 12; %global monthy&i.; call symput("monthy&i.",put(intnx('month',&dt.,(-&i.)+1,'e'),monyy5.))); %end;
run; %mend; %iter();
Thanks, it worked. Just that the code you shared had too many brackets, but removing them got me the required result. Appreciate the help, thanks again !
Why did you code a %DO loop in a data step?
data _null_;
do i=1 to 12;
call symputx(cats('monthy',1)
,propcase( put( intnx('month',&dt.,1-i,'e') ,monyy5.) )
,'g');
end;
run;
Also why are you using only 2 digits for the year? Use MONYY7 to get full four digits of the year.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: