That was fast.
Thank you VERY much guys.
Tinna
On 9/8/05, Roger Newson <[email protected]> wrote:
> At 21:45 08/09/2005, Tina wrote:
> >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==.
>
> You should use either the r() results (see -whelp return-) or -egen- (see
> -whelp egen-).
>
> The first way is like:
>
> generate varnameAVE=varname
> summarize varnameAVE
> replace varnameAVE=r(mean) if missing(varnameAVE)
>
> The second way is like:
>
> generate varnameAVE=varname
> egen AVE=mean(varnameAVE)
> replace varnameAVE=AVE if missing(varnameAVE)
>
> Both the returned r() results and -egen- are very useful in many more ways
> than this, and it is a good idea to find out more about them.
>
> I hope ths helps.
>
> Roger
>
>
> --
> Roger Newson
> Lecturer in Medical Statistics
> Department of Public Health Sciences
> Division of Asthma, Allergy and Lung Biology
> King's College London
>
> 5th Floor, Capital House
> 42 Weston Street
> London SE1 3QD
> United Kingdom
>
> Tel: 020 7848 6648 International +44 20 7848 6648
> Fax: 020 7848 6620 International +44 20 7848 6620
> or 020 7848 6605 International +44 20 7848 6605
> Email: [email protected]
> Website: http://phs.kcl.ac.uk/rogernewson/
>
> Opinions expressed are those of the author, not the institution.
>
> *
> * 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/