I have a date function in EIS column (EX:05FEB2007), I want to loop the year from 31DEC2012 to 31DEC2022, but have to do like 31DEC2012-EIS up to 31DEC2022-EIS in a loop.
%MACRO NFORE;
%LET UC=100;
%LET YS=2012;
%DO I = 0 %TO 10;
%LET YRS=%EVAL(&YS+&I);
proc sql;
create table FORECAST_&YRS as
select t.*,
case when (31DEC&YRS-EIS)/365<=10 then Segment_10
when (31DEC&YRS-EIS)/365<=20 then Segment_20
when (31DEC&YRS-EIS)/365<=30 then Segment_30
when (31DEC&YRS-EIS)/365<=99 then Segment_35
else stat
end as TSN_AGE_&YRS
from F_AG t;
quit;
%END;
%MEND NFORE;
%NFORE;