I am, of course, assuming that your date_key variable contains valid SAS dates, which means it is numeric and has a YYMMDDN8. format attached.
With SAS dates, the code works, see here:
data have;
input date_key yymmdd10.;
format date_key yymmdd10.;
datalines;
2021-09-20
2021-08-31
;
proc sql noprint;
select intnx('month',max(date_key),-12,'b') into : cutoff
from have;
quit;
data _null_;
cutoff = &cutoff;
put cutoff yymmdd10.;
run;
Log excerpt:
82 data _null_;
83 cutoff = &cutoff;
84 put cutoff yymmdd10.;
85 run;
2020-09-01
... View more