Thanks a lot. I created the code by your tip. Now there is another problem. As you can see in parameter &vector the last argument is coming with many spaces. I don't understand why because sas parameter should remove spaces /*Current month*/
%let CurMon=1807;
%put &CurMon;/*1807*/
%let CurMon_date=%sysfunc(inputn(&CurMon.,yymmn4.));
%put &CurMon_date;/*21366*/
/*Previous month*/
%let PrevMon=%sysfunc(intnx(MONTH,&CurMon_date,-1),yymmN4.);
%put &PrevMon;/*1806*/
/*Same month previous year*/
%let SameMonPrevYear=%sysfunc(intnx(MONTH,&CurMon_date,-12),yymmN4.);
%put &SameMonPrevYear;/*1707*/
/*Last DEC*/
Data _null_;
yy=substr(compress(&CurMon.),1,2)-1;
mm=12;
yymm=CAT(yy,mm);
call symput('lastDECMon',yymm);
run;
%put &lastDECMon;/*1712*/
/*Last month in previous qurater*/
data _null_;
f=intnx('quarter',&CurMon_date.,-1);
f2=intnx('quarter',f,0,'e');
f3=put(f2,yymmn4.);
call symput('PrevQ',f3);
format f f2 date9.;
run;
%put &PrevQ;/*1806*/
/*Vector of months*/
%let vector=&CurMon+&PrevMon+&lastDECMon+&PrevQ;
%put &vector;
... View more