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
Suest CommandThe following is from Suest help file Example 2: Do coefficients vary between groups? ("Chow test")…
Dialog box: how to force waiting for user's input?Dear Stata list, I have a do-file that first collects username and password via dialog box, then pr…
Stata regression output failHey Stata community, I just ran a few regressions and was wondering why Stata isn't telling me all …
What kinds of advantages we may have for the integrated use of Stata with DBMS (such as SQL Server)?What kinds of advantages we may have for the integrated use of Stata with DBMS? Any advantages for …
Chained Imputation - Auxiliary variablesHello I'm trying to do MICE imputation in Stata. I have 17 variables in the analysis model and I h…
Subscribe to:
Post Comments (Atom)
0 Response to Creating event time variable
Post a Comment