Announcement

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

  • Creating a variable to mark an intervention

    Hi

    I have a time series data set with three variables: CodedOffense, dm, and count (coded offense summarized by month). dm is my time variable, and it ranges from 2012m1 to 2020m7.

    I would like to create dummy variable for when the intervention started (August of 2018) , and then expanded (October 2019). I tried different codes, but I seem to get the syntax wrong each time.

    Thank you for any advice you may have!

    Natalie

  • #2
    Assuming that you properly declared your time variable as year-month

    Code:
    gen wanted= inrange(dm, tm(2018m8), tm(2019m10))

    Comment


    • #3
      thank you!

      Comment

      Working...
      X