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

st: Lags (verification)


From   "Maureen Paul" <[email protected]>
To   <[email protected]>
Subject   st: Lags (verification)
Date   Mon, 11 Nov 2002 16:37:31 +0000

Hi

Just would like to verify that the following works. I am mainly concerned because the gap between the last two years is three while for the others the gap is two.
Here goes:
I have data for years 1991 1993 1995 1997 and 2000. I would like to create the lags of a variable LAGVAR, this is what I have done:

ge LAGVAR1=VAR-L2.VAR
          foreach i of numlist 2000 { replace LAGVAR1=. if wave==`i' }
ge LAGVARl2=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~=.

Any help is much appreciated.
Maureen

*
*   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