Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st:filling missing by mean value of "inrange"


From   Woong.Chung@colorado.edu
To   statalist@hsphsun2.harvard.edu
Subject   st:filling missing by mean value of "inrange"
Date   Sat, 12 Aug 2006 00:50:43 -0600

Hello.
I need your help to fill in missing values by average values of inrange.
In detail, I have a dataset as follows:

     Id           year        outcome
> >  2000        1981          .
> >  2011        1981          2
> >  2013        1981          3
> >  2020        1981          .
> >  2021        1981          4
> >  2022        1981          2
> >  2023        1981          3
> >    ..
> >   ..
> > 2000        1982           .
> > 2011        1982           1
> > 2013        1982           2
> > 2020        1982           .
> > 2021        1982           3
> > 2022        1982           4
    2023        1982           2

  what I am trying to do is to fill in missing outcomes of ID=2000 and ID=2020
by following methods:

   Id           year        outcome
> >  2000        1981          2.8( average of outcomes along with Id=20xx)
> >  2011        1981          2
> >  2013        1981          3
> >  2020        1981          3.6666(average of outcomes along with ID=202x)
> >  2021        1981          4
> >  2022        1981          2
> >  2023        1981          3
> >    ..
> >   ..
> > 2000        1982           2.5(average of outcomes w/id=20xx
> > 2011        1982           1
> > 2013        1982           2
> > 2020        1982           3 (average of outcomes w/id=202x)
> > 2021        1982           3
> > 2022        1982           4
    2023        1982           2

I have 10 years more, which need to be filled.

Appreciate if anyone helps me for this

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