|
楼主

楼主 |
发表于 2013-10-12 19:21:16
|
只看该作者
求教函数无效问题
求教,我输入以下代码,想要根据过去j个月股票的收益率排名,可是下面一段代码就出错了,不知道是什么原因。有没有大侠可以赐教?
data k;
input permno date closeprice @@;
cards;
1 19900618 2
1 19900718 3
1 19900818 4
1 19900918 5
2 19900618 1
2 19900718 3
2 19900818 5
3 19900618 2
3 19900718 5
3 19900818 8
;
run;
data p;
set k;
return=dif(closeprice);
ret=closeprice/lag(closeprice)-1
;
run;
%let j=1;
%let k=1;
proc sql;
create table umd
as select distinct a.permno, a.date, exp(sum(log(1+b.ret))) - 1 as cum_return
from p (keep=permno date) as a, p as b
where a.permno=b.permno and 0<=intck('month', b.date, a.date)<&J
group by a.permno, a.date
having count(b.ret)=&J;
quit;
出错部分日志如下:
444 %let j=1;
445 %let k=1;
446
447 proc sql;
448 create table umd
449 as select distinct a.permno, a.date, exp(sum(log(1+b.ret))) - 1 as cum_return
450 from p (keep=permno date) as a, p as b
451 where a.permno=b.permno and 0<=intck('month', b.date, a.date)<&J
452 group by a.permno, a.date
453 having count(b.ret)=&J;
NOTE: Invalid (or missing) arguments to the LOG function have caused the function to return a
missing value.
NOTE: Invalid argument to function INTCK. Missing values may be generated.
NOTE: Table WORK.UMD created, with 0 rows and 3 columns.
454 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
cpu time 0.06 seconds |
|