我在 EIS 列中有一个日期函数(EX:05FEB2007),我想将年份从 31DEC2012 循环到 31DEC2022,但必须在循环中执行 31DEC2012-EIS 到 31DEC2022-EIS 之类的操作。
%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;