Hi, I'm struggling to find a simple way of conditionally setting a variable to the number of the previous month despite having spent a long time trawling through forum answers and trying to interpret answers so apologies for the schoolboy question. Please can someone explain to me why the following code is returning the error "Required operator not found in expression: &x = 0?: %macro MonthNumber(x);
%if &x = 0 %then 12;
%else Month(Date())-1;
%mend MonthNumber;
%LET MonthNo = Month(Date())-1;
%LET END_DATE = intnx('month',MDY(%MonthNumber(&MonthNo),1,Year(Date())) ,0,'end'); Any help is much appreciated, Rowan
... View more