Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating event time variable

    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?






  • #2
    Duplicate thread. Interested readers can follow the discussion here: Create event time variable

    Comment

    Working...
    X