Announcement

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

  • Lead variables in Stata

    I want to create a lead variable in Stata in my balanced panel data set. However, if I create the lead variable in Stata now it also converts the data for another company.
    However, I want exclude the data at all "2014" rows. I have used the command

    gen rdintensitylead = rdintensity[_n+1]

    Can someone help me?

    Thanks in advance!
    year rdintensity rdintensitylead
    2011 .139 .202
    2012 .202 .204
    2013 .204 .217
    2014 .217 .012
    2011 .012 .025
    2012 .025 .010

  • #2
    As you have panel data:

    Code:
    xtset company year
    gen wanted= F.rdintensity
    where "company" is the name of your panel-identifier (firms).

    Comment


    • #3
      Thank you Andrew!

      Comment

      Working...
      X