Hi all,
This is a small part of my dataset. My dataset has more than 1,5million observations.
permno = id of each company
ret = daily returns
cum abnormal return = return of each observation in event window (t+5) minus average of estimation window (lags) and all summed together
Averagereturn = average return of estimation window
I am currently performing an event study on my dataset. Now I am at the part where I have to calculate abnormal returns for every observation within the event window. Calculating cumulative abnormal returns for every "EventDate"/"EventDummy" did work for me because I do not need to calculate for every observation (no overwriting values at all!!). Since I have multiple companies with multiple events, it will make the process more difficult.
Basically, I tried using this code:
gen NewVariable=.
by permno:replace NewVariable=(ret[_n] - averagereturn[_n] + ret[_n+1] -averagereturn[_n]] + ret[_n+2] -averagereturn[_n] + ret[_n+3] -averagereturn[_n]] + ret[_n+4] -averagereturn[_n] + ret[_n+5] -averagereturn[_n] ) if EventDummy[_n]==1
Obviously, this will overwrite observations when I have consecutive events (difference in days less than 5 days). How can I stack those calculated values into a new variable? I would like to have all the values under each other without overwriting old values, if you know what I mean. I need all those abnormal returns in order to calculate the standard deviation for testing the significance.
I really appreciate it if you could help me!
Thank you in advance and sorry for the grammar mistakes!
Best regards,
Peter
This is a small part of my dataset. My dataset has more than 1,5million observations.
permno = id of each company
ret = daily returns
cum abnormal return = return of each observation in event window (t+5) minus average of estimation window (lags) and all summed together
Averagereturn = average return of estimation window
permno | date | ret | EventDate | EventDummy | AverageReturn | cumabnormalreturn |
91735 | 26-aug-11 | 0.015625 | 26-aug-11 | 1 | -0.0129789 | 0.090525 |
91735 | 29-aug-11 | 0.053846 | 29-aug-11 | 1 | -0.0129389 | 0.038577 |
91735 | 30-aug-11 | 0.002433 | . | . | . | . |
91735 | 31-aug-11 | -0.00485 | . | . | . | . |
91735 | 1-sep-11 | -0.02683 | . | . | . | . |
91735 | 2-sep-11 | -0.02757 | . | . | . | . |
91735 | 6-sep-11 | -0.03608 | . | . | . | . |
I am currently performing an event study on my dataset. Now I am at the part where I have to calculate abnormal returns for every observation within the event window. Calculating cumulative abnormal returns for every "EventDate"/"EventDummy" did work for me because I do not need to calculate for every observation (no overwriting values at all!!). Since I have multiple companies with multiple events, it will make the process more difficult.
Basically, I tried using this code:
gen NewVariable=.
by permno:replace NewVariable=(ret[_n] - averagereturn[_n] + ret[_n+1] -averagereturn[_n]] + ret[_n+2] -averagereturn[_n] + ret[_n+3] -averagereturn[_n]] + ret[_n+4] -averagereturn[_n] + ret[_n+5] -averagereturn[_n] ) if EventDummy[_n]==1
Obviously, this will overwrite observations when I have consecutive events (difference in days less than 5 days). How can I stack those calculated values into a new variable? I would like to have all the values under each other without overwriting old values, if you know what I mean. I need all those abnormal returns in order to calculate the standard deviation for testing the significance.
I really appreciate it if you could help me!
Thank you in advance and sorry for the grammar mistakes!
Best regards,
Peter