I am trying to calculate the buy and hold returns for an event study. The window is -210, -11. Data is from CRSP.
I tried the codes below but it gave first only "." in the returnproduct variable (first code), and with the second code I got error "not sorted".
Does someone know how to put in the code the estimation window and help me with this?
I have a dataset of CRSP and T1 combined. I have duplicates of 302 for each event id because I had to calculate cumulative abnormal returns over the event window (-2,+2) and estimation window (-91,-300).
I tried the codes below but it gave first only "." in the returnproduct variable (first code), and with the second code I got error "not sorted".
Does someone know how to put in the code the estimation window and help me with this?
I have a dataset of CRSP and T1 combined. I have duplicates of 302 for each event id because I had to calculate cumulative abnormal returns over the event window (-2,+2) and estimation window (-91,-300).
Code:
bysort adate_and_cusip: gen mrkt_ret_1 = mrkt_ret+1 egen double returnproduct = total(ln(mrkt_ret_1)) replace returnproduct = exp(returnproduct)
Code:
bysort adate_and_cusip: gen mrkt_ret_1 = mrkt_ret+1 gen double returnproduct = 1 if _n == 1 bysort adate_and_cusip: replace returnproduct = L.returnproduct*mrkt_ret_1