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

Re: st: Averages for missing values


From   [email protected]
To   [email protected]
Subject   Re: st: Averages for missing values
Date   Thu, 8 Sep 2005 13:54:21 -0700 (PDT)

perhaps this may work:

gen varnameAVE = varname
su varnameAVE, meanonly
replace varnameAVE=r(mean) if varname==.


hope this helps,
--clint


> Hello Statalist.
>
> Before I give myself carpal tunnel syndrome I might ask:
>
> Is there a command to replace missing values with averages?
>
> What I am currently doing is:
>
> generate varnameAVE=varname
> summarize varnameAVE
> replace varnameAVE=[here I use the mouse to copy from the results
> window to the command window] if varnameAVE==.
>
> Thanks
> Tina
>
> *
> *   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/
>


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