Statalist


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

Re: st: store means as a new variable


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: store means as a new variable
Date   Sat, 23 Feb 2008 09:05:09 -0500

Wencke,

You can use -egen- to generate variables with the mean and standard deviation.

. sysuse auto
. bysort rep78 foreign: egen mpgmean = mean(mpg)
. bysort rep78 foreign: egen mpgsd = sd(mpg)

The mean and standard deviation can also be calculated with
-summarize-. Enter -return list- to see which results you can access
with other commands.

. sum mpg
. return list
. gen mpgmean = r(mean)
. gen mpgsd = r(sd)

Friedrich

On Sat, Feb 23, 2008 at 6:47 AM, Wencke <[email protected]> wrote:
> Dear Stata-Users,
>
>  how can I store estimates of mean values as well as their standard
>  deviation as new variables in my dataset?
>
>  This is the command for the mean-values, I am using:
>  mean maxgrip, over(gender ph013_)
>
>  Thank you very much for helping.
>
>  All the best,
>  Wencke Gwozdz
*
*   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