You can use qtr function and ' if then ' again %let Reporting_date=20171231; data test ; length months $8; year=year(input("&Reporting_date",yymmdd8.)); if qtr(input("&Reporting_date",yymmdd8.))=1 then months='1,2,3'; else if qtr(input("&Reporting_date",yymmdd8.))=2 then months='4,5,6'; else if qtr(input("&Reporting_date",yymmdd8.))=3 then months='7,8,9'; else if qtr(input("&Reporting_date",yymmdd8.))=4 then months='10,11,12'; put year=/months=; run;
... View more