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

st: RE: Lags (verification)

From   "Maureen Paul" <>
To   <>
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
           foreach i of numlist 2000 { replace LAGVAR1=. if 
 wave==`i' }
          foreach i of numlist 1991 1993 1995 1997 { replace 
 LAGVAR2=. if wave==`i' }
 replace LAGVAR=LAGVAR2 if LAGVAR2~=.

*   For searches and help try:

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