Hi JJP1, Do you mean all your data looks like this: Year Month 2019 01 2018 02 2019 03 But you dont have a day Variable? Is your intention to get the full 12 months regardless of the date? E.g., today is Nov 25, 2019, you want to include From Dec 01, 2018 to today? Since you don't have day variable, you can default to 01 all the days. Then read as yyyymmdd, then use intck to count 12 months from today data ck ;
year=2019 ;
month=9 ;
new_month = COMPRESS(PUT(year,4.)||PUT(month,z2.)||"01") ;
FORMAT inputasdate date9. ;
inputasdate = INPUT(new_month,yymmdd8.) ;
_12months = intck("months",inputasdate, today()) ;
IF 0<= _12months <=12 ;
RUN ; Please take note that the year and month, I suppose they are numbers Please let us know if we get your issue correctly?
... View more