Skip to content

Commit 2299edb

Browse files
committed
ZZ2_AnnouncementReturn.do extra comments
For sanity, added copious comments
1 parent f5cf185 commit 2299edb

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Open source cross sectional asset pricing
1+
# Open source cross sectional asset pricing s
22

33
This repo accompanies our paper:
44
[Chen and Zimmermann (2021), "Open source cross-sectional asset pricing"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3604626)

Signals/Code/Predictors/ZZ2_AnnouncementReturn.do

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,28 @@ drop _merge gvkey
3838
rename time_ann_d time_d
3939
merge m:1 time_d using "$pathDataIntermediate/dailyFF", nogenerate keep(match) keepusing(mktrf rf)
4040

41-
4241
// SIGNAL CONSTRUCTION
4342
gen AnnouncementReturn = ret - (mktrf + rf)
4443
bys permno (time_d): gen time_temp = _n // To deal with weekends
4544
xtset 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.
4750
gen time_ann_d = time_temp if anndat == 1
4851
replace time_ann_d = time_temp + 1 if f1.anndat == 1
4952
replace time_ann_d = time_temp + 2 if f2.anndat == 1
5053
replace time_ann_d = time_temp - 1 if l1.anndat == 1
51-
52-
gen AnnTime = time_d if anndat == 1
5354
drop 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
5560
gcollapse (sum) AnnouncementReturn (max) time_d, by(permno time_ann_d)
61+
62+
* convert the daily date to monthly date
5663
gen time_avail_m = mofd(time_d)
5764
format time_avail_m %tm
5865

@@ -80,4 +87,4 @@ drop temp
8087
label var AnnouncementReturn "Earnings announcement return"
8188

8289
// SAVE
83-
do "$pathCode/savepredictor" AnnouncementReturn
90+
do "$pathCode/savepredictor" AnnouncementReturn

0 commit comments

Comments
 (0)