Announcement

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

  • generate POST and PRE Variable

    Hi everybody,

    I want to generate a dummy POST and PRE variable in panel. When in the panel a certain CIK gets 1 from the variable Controversies the variable POST must get 1 the next FiscalYear and when in panel a certain CIK gets from the variable controversies the variable PRE must get the previous FiscalYear.

    Can anyone help?

    Thanks! dataex.sthlp

  • #2
    here a photo of the data
    Attached Files

    Comment


    • #3
      Perhaps
      Code:
      bysort CIK (FiscalYear): generate POST = (Controversies[_n-1]==1)  // previous observation has Controversies==1
      bysort CIK (FiscalYear): generate PRE  = (Controversies[_n+1]==1)  // next observation has Controversies==1

      Comment


      • #4
        Dear William,

        Thanks!! Solved!

        Comment

        Working...
        X