I'm trying to adjust the reporting period between 1 month and 3 months (full quarter) based on time of the month. Based on the date below, I should be getting the period between 1/1 and 3/31, but I'm getting a logic error when I run the following code, any advice on how to fix it?
ERROR: Expected close parathesis after macro function invocation not found. ERROR: Required operator not found in expression: 0 ) ERROR: SKipping to next %END statement.
%let obsdate = '31Mar2021'd;
%let current_qtr_first_day = intnx('month', &obsdate, -2, 'B');
%let current_qtr_last_day = intnx('month', &obsdate, 0, 'E');
%let current_month_first_day = intnx('month', &obsdate, 0, 'B');
%let current_month_last_day = intnx('month', &obsdate, 0, 'E');
%if %sysfunc(MOD(month(&obsdate),3)=0 ) %then %do;
%let startdt = &obsdate_current_qtr_first_day;
%let enddt = &obsdate_current_qtr_last_day;
%end;
%else %do;
%let startdt = &obsdate_current_month_first_day;
%let enddt = &obsdate_current_month_last_day;
%end;
%SYSFUNC()
for your first set of%LET
statements as well as some semicolons to end the%LET
statements. You need one for every function in your macro code. I think once you fix that it'll work – Reeza