使用proc sql求国泰安中的年度个股收益率,程序如下:
proc sql;
create table annual_return as select distinct a.stkcd,a.year,a.month,sum(b.Mretwd) as annual_return
from monthly_return as a,monthly_return as b
where a.stkcd=b.stkcd and a.year=b.year
group by a.stkcd,a.year;
quit;
其中monthly_return是月度个股收益率数据,Mretwd是月度收益率。sas没有报错,但是算出的结果特别大有5000……
我知道设置a和b有点冗余,就是求问大神,程序错在哪里啊~~~不胜感激