作者LittleMore (LittleMore)
看板Statistics
标题[程式] SAS 累加 事件研究法
时间Sun Mar 29 14:30:19 2015
[软体程式类别]:sas [软体熟悉度]:低(1~3个月)
[问题叙述]:
累加出问题 请帮我看看 麻烦各位 谢谢了
我希望第11笔资料的ar4=-0.06122 car=-0.06122 不是 car=0.0534
资料数据:
http://i.imgur.com/4i95Ezc.jpg
[程式范例]:
(1)排序:依宣告日、分析师、宣告时间
proc sort data=old;
by event_obs announce_date analyst_name announce_time time;
run;
(2)累加
data new;
set old;
by event_obs announce_date analyst_name announce_time time;
car+ar4;
if first.analyst_name and first.announce_time then car=ar4;
run;
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.167.88.71
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Statistics/M.1427610621.A.D05.html
※ 编辑: LittleMore (1.167.88.71), 03/29/2015 16:01:10
1F:→ redcurrant: 因为第11笔并不是first.analyst_name(和前同名) 03/29 22:06
2F:→ redcurrant: 不如用 if first.IBES Recom Code ? 03/29 22:08
恩 我有用if first.IBES Recom Code 还是没有呈现效果
结果与下面这样相同
data new;
set old;
by event_obs announce_date analyst_name announce_time time;
car+ar4;
if first.analyst_name then car=ar4;
run;
3F:推 tew: if dif(time)^=1 then car=ar4; 03/30 11:40
原来LAG有dif这个用法 晚点来试试看 谢谢
4F:→ tew: 你後续实证要小心 目前看都是同一家公司同一天的资料 03/30 11:42
5F:→ tew: 不可能当做是不同的随机样本处理 03/30 11:42
恩~~谢谢提醒
※ 编辑: LittleMore (220.129.67.83), 03/30/2015 22:20:43