FYI - This code returns the wrong value for cmonth_name. Don't use the month() function when using monname. The format needs to be used with a date. I modified here for the correct solution for the request. Notice the difference in line 3: data _null_;
call symputx('cmonth',month(today()));
call symputx('cmonth_name',put(today(),monname.));
call symputx('pmonth',month(intnx('month',today(),-1)));
call symputx('cyear',year(today()));
call symputx('pyear',year(intnx('month',today(),-1)));
run;
... View more