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

st: RE: Couldn't Create Lag Variable in STATA


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Couldn't Create Lag Variable in STATA
Date   Fri, 12 Mar 2004 09:47:22 -0000

I can't reproduce this problem. 

In any case, these look like panel data. Check 
out -tsset- and the L. operator for lag variables. 
That's usually better than using [_n-1]. 

Nick 
n.j.cox@durham.ac.uk 

Nomorenook@netscape.net
 
> I have a dataset I couldn't create lag variable. The details 
> are as follows:
> 
> It is a variable for each state and each year. So what I did was:
> 
> sort state year
> gen V1=V[_n-1]
> 
> However, what I got in STATA is
> weights not allowed 
> r(101);
> 
> Anyone have any idea what is going on? How can I create a lag 
> variable in this case?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index