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   Stas Kolenikov <[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 09:58:36 -0600

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.

On 12/6/05, Nirina M. <[email protected]> wrote:
> Hello Friends,
> 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.
> How do I deal with that?
> Thanks a lot.
>
>
>
> __________________________________________
> Yahoo! DSL – Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
> *
> *   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/
>


--
Stas Kolenikov
http://stas.kolenikov.name

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