Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Lags (verification)


From   "Maureen Paul" <[email protected]>
To   <[email protected]>
Subject   st: RE: Lags (verification)
Date   Mon, 11 Nov 2002 17:08:58 +0000

Hi, I would like to regard the years as the time variable, I think. It is a panel, so I have tsset as follows (wave is the year variable): tsset pid wave.
I have a variable called, say, VAR and I would like to create a new variable LAGVAR, which contains its lags taking into consideration that there is a gap of 2 years between each waves and in one case the gap is 3 years. Could you suggest how I could change what I have done to achieve this purpose? Would numbering the waves 1 to 5 still be appropriate?  Thanks. I include what I did before again.

tsset pid wave
ge LAGVAR1=VAR-L2.VAR
           foreach i of numlist 2000 { replace LAGVAR1=. if 
 wave==`i' }
ge LAGVAR2=LAGVAR-L3.LAGVAR
          foreach i of numlist 1991 1993 1995 1997 { replace 
 LAGVAR2=. if wave==`i' }
 ge LAGVAR=LAGVAR1 if LAGVAR1~=.
 replace LAGVAR=LAGVAR2 if LAGVAR2~=.



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index