I would not expect SAS functions to be resolved in an ods statement. Instead use %sysfunc in the macro variable definitions: %LET begperiod = %sysfunc(intnx(Year.4, %sysfunc(intnx(Month, %sysfunc(today()),-1,E)),0,B)); %LET endperiod = %sysfunc(putN(%sysfunc(intnx(Month, %sysfunc(today()),-1,e)),monyy7.)); ods tagsets.excelXP file="U:\2013-14 Income Reports\Incomerpt&begperiod up to end of &endperiod.xls"; Alternately do the calculations in a data _Null_ step : data _Null_ ; begperiod = intnx('Year.4',intnx('Month',today(),-1,'E'),0,'B'); endperiod = put(intnx('Month',today(),-1,'e'),monyy7.); Call Symput ('begperiod', begperiod) ; /* leading spaces */ Call Symput ('endperiod', endperiod) ; run ; %Let begperiod = &begperiod ; /* to manage trimming */ The code is going to deliver a SAS date numeral for &begperiod - is that what you want? (Untested - check for missing or misplaced parentheses, use putn instead of put) Richard temporarily back in Oz
... View more