全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1311 4
2014-07-31

[size=12.800000190734863px]Hello I'm working on some project and need to count number of events between any of two event dates for each firm. I have data look like this:

                              event date                        firm cusip       number of event +/- 183 daysnumber of events +/-365 daysnumber of event +/- 548 days

1991/2/21

21

1992/3/24

21

1994/3/7

361

1997/6/10

361

1998/9/9

361

2000/1/11

361

2009/6/15

361

1996/8/2

375

1997/1/23

375

1998/3/24

375

1999/7/21

375

1999/8/26

375

1999/11/28

375

2000/1/13

375

2000/5/8

375

2000/6/15

375

2000/6/30

375

2000/7/4

375

2000/7/6

375

2000/9/25

375

2000/10/5

375

2000/10/16

375

2001/2/19

375

2004/4/1

375

2005/6/22

375

2005/12/20

375

2007/6/14

375

2008/4/16

375

2008/8/22

375

2008/10/23

375

2009/3/31

375

2009/12/10

375

2011/6/12

375

2011/8/1

375

2012/3/6

375

2013/5/7

375



[size=12.800000190734863px]For column named number of event +/- , I need to count, for the same firm, number of event dates within the range of [-183,+183], [-365,+365],[-548,+548] relative to the event date on the same row. So for example, for firm with cusip=21, there are 397 days between two event date, 1991/2/21 and 1992/3/24, so in the first row, there are 0 event within the range of [-183,+183] relative to 1991/2/21, but there are 1 event within the range of  [-365,+365], and 1 event within the range of [-548,+548]. In the second row, I need to count the number of event for the same firm within these three ranges relative to the date of 1992/3/24. I need to do the same for three firms. This is the first time I do this kind of counting staff and I tried several method but they do not work on all of the firms. Please help!!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-7-31 16:26:03
能说清楚问题吗?不太明白你的表达
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-8-1 08:30:12
double set statments can finish your task
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-8-1 19:50:36
第一行还能看懂,第二行就不知道你要干嘛了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-8-1 21:34:22
感觉楼主描述的很清楚了,唯一句话可能是楼主的笔误:but there are 1 event within the range of  [-365,+365], and 这句话里面的1可能是0.误写成1了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群