You have several things wrong starting the conversion of YYYYMM to date. I formatted STARTQTR but you may want to leave it integer(sas date). Consider the follow /* %let cutoff = 201506; %let averageperiod = 8; %let startqtr = %SYSFUNC(intnx('qtr', %input(%put(&cutoff*100+ 01,8.),yymmdd8.), -&averageperiod, 'same')); %put &startqtr; */ %let cutoff = 201506; /*To convert CUTOFF to SAS date you can use YYMMN informat*/ %let cutoffdate = %sysfunc(inputn(&cutoff,yymmn,6)); %put &=cutoffdate; %let averageperiod = 8; /*dont use quotes 'qtr' and 'same' are wrong*/ %let startqtr = %SYSFUNC(intnx(qtr, &cutoffdate, -&averageperiod, same),date9); %put &=startqtr; 32 /*To convert CUTOFF to SAS date you can use YYMMN informat*/ 33 %let cutoffdate = %sysfunc(inputn(&cutoff,yymmn,6)); 34 %put &=cutoffdate; CUTOFFDATE=20240 35 36 %let averageperiod = 8; 37 /*dont use quotes 'qtr' and 'same' are wrong*/ 38 %let startqtr = %SYSFUNC(intnx(qtr, &cutoffdate, -&averageperiod, same),date9); 39 %put &=startqtr; STARTQTR=01JUN2013
... View more