Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Aggregate and Microdata


From   David Jacobs <jacobs.184@sociology.osu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Aggregate and Microdata
Date   Mon, 18 May 2009 16:47:32 -0400

Assuming you're using a recent version of Stata, if you use Stata's lag operators, the lags won't "spill over" into the prior case. Just put a L. in front of any variable you wish to lag. And check out the time series manual or the help files.

Dave Jacobs

At 04:30 PM 5/18/2009, you wrote:
Dear Stata Users,

Im using a microdata set. Im estimating aggregates with the data set. The data set is unbalanced. A situation arises when I lag the variables by

sort  PLANT YEAR STATE COUNTY ECOGROUP FIRM
quietly by PLANT:  gen Ait1= aggregateprod[_n-1]

It generates missing values for the lag variable of the aggregate, but there should a value(with the exception of the first year), since Ait is the aggregate value by year. How can I change the missing values to the actual values without doing a replace for each year. I thank you in advance for all your help.

Sincerely,

Luis
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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