Open code %if %then %do blocks is a new feature in newer SAS versions, so extricate the assignment logic from the testing macro and use it open code. Directly assign the today macro variable the result of the TODAY() function. I use today macro variable because the concept/value of today is used in three places in order to properly assign the end_date its needed value.
%let today = %sysfunc(TODAY());
%if %sysfunc(day(&today)) >= 16 %then %do;
%let end_date = %sysfunc(intnx(semimonth2.2, &today, -1, E));
%end;
%else %do;
%let end_date = %sysfunc(intnx(month, &today, -1, E));
%end;
... View more