Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72776

Counting events in event study

$
0
0
Dear all

I have a dataset looking like this:
Date Company_id event date estimation_window event_window event_id
2015-01-01 1 1 1
2015-01-02 1 1 1
2015-01-03 1 1
2015-01-04 1 1 1
2015-01-05 1 2015-01-05 1 1
2015-01-06 1 1 1
2015-01-07 1
2015-01-08 1 1 2
2015-01-09 1 1 2
2015-01-10 1 2
2015-01-11 1 1 2
2015-01-12 1 2015-01-12 1 2
2015-01-13 1 1 2
2015-01-14 1
2015-01-15 1
2015-01-01 2 1 3
2015-01-02 2 1 3
2015-01-03 2 3
2015-01-04 2 1 3
2015-01-05 2 2015-01-05 1 3
2015-01-06 2 1 3
2015-01-07 2

I want to create the variable called event_id. This variable counts the number of events and saves the event number for all rows from the beginning of the estimation window to the end of the event window. In the dataset there is a gap of one day between the estimation- and event window. In some cases the estimation window do not have all observations for the first days and in some cases the event window do not have all observations for the last days.

This example is a simplification of my real dataset. In the real dataset the event- and estimation windows are longer.

Could someone please help me with this?

Regards

Viewing all articles
Browse latest Browse all 72776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>