我在用SAS求股票的年收益及月收益
按照朱世武的那本《基于SAS系统的金融计算》上面的程序,结果显示有问题
请教,有没有哪位用这个做过的,我到底哪里出错了,为什么算不出结果呢? 多谢各位了啊
程序如下:
data a;
input date:date9. r;
cards;
2Jan03 975.95
3Jan03 976.36
6Jan03 990.45
7Jan03 988.97
... ...
;
data garch;
set a;
year=year(date);
qtr=qtr(date);
month=month(date);
proc sort data=garch;
by year qtr month;
run;
data b;
set garch;
last_y=last.year;
last_q=last.qtr;
last_m=last.month;
by year qtr month;
run;
data r_year(keep=date r_pct r_log label="年收益");
set b;
if last_y=1;
r_pct=dif(r)/lag(r);
r_log=log(r)-log(lag(r));
run;
SAS显示的出错提示为:
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 7983:13 1 at 7984:13 1 at 7984:14