Hello everybody,
I have an unbalanced dataset, and I want to lag my Independent Variable "No_Deals" (number of deals). For this, I used the following code:
I want the Independent Variable to be lagged by two years. But my dataset shows that the lag is shifted by "two rows". This can cause a lag from the year 2010 to 2005 due to missing observations.
Is it possible that a lag is made when it is possible to lag back two years?
In the output shown below, the values are unfortunately not always exactly correct (see for the example year 2005 on 2003).
Hopefully, the question is understandable.
Thank you!
Peter
I have an unbalanced dataset, and I want to lag my Independent Variable "No_Deals" (number of deals). For this, I used the following code:
Code:
bysort gvkey (fyear): generate N_Deals_lag2=No_Deals[_n+2]
Is it possible that a lag is made when it is possible to lag back two years?
In the output shown below, the values are unfortunately not always exactly correct (see for the example year 2005 on 2003).
Hopefully, the question is understandable.
Thank you!
Peter
HTML Code:
gvkey fyear No_Deals N_Deals_lag2 001078 2002 1 2 001078 2003 1 1 001078 2005 2 2 001078 2006 1 1 001078 2007 2 2 001078 2008 1 2 001078 2010 2 1 001078 2011 2 3 001078 2014 1 3 001078 2015 3 7 001078 2016 3 14 001078 2017 7 1 001078 2018 14 . 001078 2019 1 .
Comment