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

RE: st: Panel data: how to deal with varbles existing in 98 but not in 99


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Panel data: how to deal with varbles existing in 98 but not in 99
Date   Tue, 6 Dec 2005 16:02:51 -0000

This answer takes Nirina to mean "observations"
when she says "variables". I did wonder this 
myself, but it is not what she said. 

Nick 
[email protected] 

Stas Kolenikov
 
> Depends on what you want to do with them. You can -drop- them, or you
> can fill them in by
> 
> sort panelid time
> unab allvars : *
> foreach x in varlist `allvars' {
>    bysort panelid (time): replace x=x[_n-1] if mi(x)
> }
> This may lead to some awkward results, and sometimes the missing value
> is a valid one (e.g. a wage of somebody who was employed in the first
> period, but not in the second one), so if you know the variables you
> want to fill in by the prior values, you should put them as the
> varlist in -foreach- above.
 
Nirina M. 

> > my question should be very easy but forgive my
> > d..ness.
> > I am creating a panel data but the trouble now is that
> > there are variables that exist in the start of the
> > survey but does not exist in the following year:(or
> > sometimes new questions come up in the following year
> > but were not asked before): say the religion, they ask
> > it in 98 but not later.

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