[版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規]
1.不回覆私底下email的問題。有問題的請在此留言。
2.不保證能夠回答所有問題。
3.不協助debug。
4.SAS軟體本身的問題請自行聯繫SAS客服部門。
[版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規][版規]
CODE { display: block; /* fixes a strange ie margin bug */ font-family: Courier New; font-size: 8pt; overflow:auto; background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y; border: 1px solid #ccc; padding: 10px 10px 10px 21px; max-height:200px; height:200px; // for IE6 line-height: 1.2em; }
版主你好..我寫了一堆語法..
回覆刪除不過因為要repeat的理由才停下筆..
請你花小小時間幫我一下可以嘛?十分感謝!
data data;
input yr y;
cards;
1988 55
1989 70
1990 90
1991 150
1992 170
run;
data addyr;
set data end=end;
output;
if end then do until(yr=2002);
yr+1; y=.;
output;
end;
run;
data Q1;
set addyr;
retain ytop 0;
if _n_=1 then ytop=y;
else do;
f=0.1;
ytop=ytop*(1-f)+y;
end;
aaa=0; ybar=0;
do m=1 to _n_;
f=0.1;
aa= (1-f)**(m-1);
aaa=aa+aaa;
end;
ybar=ytop/aaa;
run;
data Q2;
set Q1;
retain r1 0;
r1=lag(ybar);
r=ybar/r1;
run;
data Q3;
set Q2;
retain rtop 0;
if _n_=2 then rtop=r;
else do;
f=0.1;
rtop=(1-f)*rtop+r;
end;
aaa=0; rbar=0;
do m=2 to _n_;
f=0.1;
aa= (1-f)**(m-2);
aaa=aa+aaa;
end;
rbar=rtop/aaa;
run;
data Q4;
set Q3;
lybar=lag(ybar);
lrbar=lag(rbar);
py=lybar*lrbar;
run;
/*在此重覆以下步驟至2002年..*/
data p2Q5;
set Q4;
ppy=y;
run;
data p1Q5;
set Q4;
ppy=py;
run;
data pQ5;
update p1Q5 p2Q5;
by yr;
run;
data Q5;
set pQ5;
retain pytop 0;
if _n_=1 then pytop=ppy;
else do;
f=0.1;
pytop=pytop*(1-f)+ppy;
end;
aaa=0; pybar=0;
do m=1 to _n_;
f=0.1;
aa= (1-f)**(m-1);
aaa=aa+aaa;
end;
pybar=pytop/aaa;
run;
data Q6;
set Q5;
retain r2 0;
r2=lag(pybar);
pr=pybar/r2;
run;
data Q7;
set Q6;
retain prtop 0;
if _n_=2 then prtop=pr;
else do;
f=0.1;
prtop=(1-f)*prtop+pr;
end;
aaa=0; prbar=0;
do m=2 to _n_;
f=0.1;
aa= (1-f)**(m-2);
aaa=aa+aaa;
end;
prbar=prtop/aaa;
run;
data Q8;
set Q7;
prbar2=lag(prbar);
py=r2*prbar2;
run;
proc print data=Q8;
run;
我想不斷repeat data p2q5 至 q8...直至2002年..
但我不知如何利用macro 才可做到...thanks so much!!