Hi, I have a time series of stock returns with multiple event date indicators, such as the following:
date return event
01jan2015 -0.2 0
02jan2015 1.2 1
03jan2015 0.3 0
04jan2015 0.4 0
05jan2015 -0.3 1
06jan2015 -0.1 0
I would like to create a new variable (timeToEvent) that takes the value of number of days from the event within a 3-day window around each event, where day 0 is each event day. The events are all spread apart by at least 3 days. For instance, it would look like this:
date return event timeToEvent
01jan2015 -0.2 0 -1
02jan2015 1.2 1 0
03jan2015 0.3 0 1
04jan2015 0.4 0 -1
05jan2015 -0.3 1 0
06jan2015 -0.1 0 1
How may I do this?
Related Posts with Creating event time variable
Appending models using coefplotI would like to merge multiple models into the same series (crude/adjusted/further adjusted models) …
match couples in a pooled quarterly cross section (Q1 only) with hhid, wave and survey year known, hhid unique to each quarter only.Dear Statalist, I am trying to match couples (married or cohab) in a pooled cross section. I have a…
Changing the line colour of panel data line plot according to an indicator variableDear forum, I have a set of longitudinal patient data representing patient id (subjid), time in stud…
suest alternative for panel dataHi, I have a panel GDP data for over 200 countries for the years 1990 to 2018, which I am reducing …
Graph export multiple using loopsI have been trying to create and export multiple graphs using the following code, instead I am getti…
Subscribe to:
Post Comments (Atom)
0 Response to Creating event time variable
Post a Comment