I want to merge event dates with a series of daily stock returns and
subsequently define various event windows. What seemed like a straight
forward problem is actually proving surprisingly difficult (for me
anyway).
I have made up some illustrative data. Suppose I have a file containing
daily returns for a couple of firms like this:
+-----------------------------+
| permno ticker date |
|-----------------------------|
1. | 10107 MSFT 04 Jan 00 |
2. | 10107 MSFT 10 Mar 00 |
3. | 10107 MSFT 22 Jun 00 |
4. | 10107 MSFT 18 Sep 00 |
5. | 10107 MSFT 28 Dec 00 |
|-----------------------------|
6. | 12490 IBM 12 Jan 00 |
7. | 12490 IBM 07 Apr 00 |
8. | 12490 IBM 25 Jul 00 |
+-----------------------------+
Merging is straightforward. However I also want to create a set of 3
event windows for each event date: pre-event, event, and post-event.
Define the event date as 0 then
pre-event = days -7 to -3
event = days -2 to +2
post-event = days +3 to + 7
** These are trading dates not calendar dates (each observation is a
trading date). **
I thought this would be easy, but I just can't seem to make it happen.
Please note that in practice I have a sample containing daily data for
thousands of firms, many of which have over 10 years of data. I also
have 4 event dates per firm-year. This means that the method shown at
which creates a duplicate set of observations for each event date /
company combination is impractical. The resulting file is simply too
large.
Here is a mocked up file showing what I am aiming for. I have shown
data around one event_date. The variable TYPE is defined as (0 =
non-event, 1 = event, 2 = pre and 3 = post.