作者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/m.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