0
我在EIS列(EX:05FEB2007)中有一個日期函數,我想循環年份從31DEC2012到31DEC2022,但必須像31DEC2012-EIS一樣循環到31DEC2022-EIS。SAS 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;
我認爲是時候對我的「我希望SAS從來沒有發明過'%do',因爲它幾乎肯定是SAS編程的淨損害」... – Joe
謝謝喬..將給嘗試。 – user2784588