At the moment I am dealing with a apparently simple problem. The following data serves as an example: I would like to create a dummy variable that takes the value 1 if the observation of the same company (gvkey) from the previous year fulfils a certain condition. My question: How is it possible that the first observation has the value 1? Why is the panel structure not taken into account? I am aware that I can simply delete the first observation. However for a better understanding, I would like to know why Stata sets the value 1 for the first observations with this command. Interestingly, the panel structure is taken into account when I generate a lag variable (first observation is always missing which is correct).
Many thanks for your help.
Roman
Code:
xtset gvkey year panel variable: gvkey (strongly balanced) time variable: year, 2008 to 2010 delta: 1 unit . gen lag = L.intcov (6 missing values generated) . gen dummy = 1 if L.intcov > 1 (8 missing values generated) . list +-------------------------------------+ | gvkey year intcov lag dummy | |-------------------------------------| 1. | 1 2008 -1 . 1 | 2. | 1 2009 1 -1 . | 3. | 1 2010 2 1 . | 4. | 2 2008 -2 . 1 | 5. | 2 2009 3 -2 . | |-------------------------------------| 6. | 2 2010 4 3 1 | 7. | 3 2008 5 . 1 | 8. | 3 2009 4 5 1 | 9. | 3 2010 1 4 1 | 10. | 4 2008 -1 . 1 | |-------------------------------------| 11. | 4 2009 1 -1 . | 12. | 4 2010 1 1 . | 13. | 5 2008 -2 . 1 | 14. | 5 2009 -2 -2 . | 15. | 5 2010 2 -2 . | |-------------------------------------| 16. | 6 2008 5 . 1 | 17. | 6 2009 -5 5 1 | 18. | 6 2010 -1 -5 . | +-------------------------------------+
0 Response to Lagged variable and panel structure
Post a Comment