@@ -38,21 +38,28 @@ drop _merge gvkey
3838rename time_ann_d time_d
3939merge m:1 time_d using " $pathDataIntermediate/dailyFF" , nogenerate keep(match) keepusing(mktrf rf)
4040
41-
4241// SIGNAL CONSTRUCTION
4342gen AnnouncementReturn = ret - (mktrf + rf)
4443bys permno (time_d): gen time_temp = _n // To deal with weekends
4544xtset permno time_temp
4645
46+ * time_temp indexes the business days for a particular permno (1,2,3,..,)
47+ * time_ann_d creates a window that starts two biz days before anndat
48+ * and ends 1 day after anndat. The value of time_ann_d is the biz day
49+ * of the anndat (unique for each announcement) but is na if outside the window.
4750gen time_ann_d = time_temp if anndat == 1
4851replace time_ann_d = time_temp + 1 if f1.anndat == 1
4952replace time_ann_d = time_temp + 2 if f2.anndat == 1
5053replace time_ann_d = time_temp - 1 if l1.anndat == 1
51-
52- gen AnnTime = time_d if anndat == 1
5354drop if mi(time_ann_d)
55+ format time_ann_d %td
5456
57+ * this is key:sum up daily returns over the window, but then assign
58+ * the daily date as the maximum of these dates in the window. So if the window
59+ * ends Jan 2, AnnouncementReturn is assigned to Jan 2
5560gcollapse (sum) AnnouncementReturn (max) time_d, by(permno time_ann_d)
61+
62+ * convert the daily date to monthly date
5663gen time_avail_m = mofd(time_d)
5764format time_avail_m %tm
5865
@@ -80,4 +87,4 @@ drop temp
8087label var AnnouncementReturn " Earnings announcement return"
8188
8289// SAVE
83- do " $pathCode/savepredictor" AnnouncementReturn
90+ do " $pathCode/savepredictor" AnnouncementReturn
0 commit comments