Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: re: Create a variable containing the means of subgroups


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: Create a variable containing the means of subgroups
Date   Sat, 03 Jan 2009 15:18:15 -0500

<>
Claude said

I would like to create a variable that would contain the means of
subgroups of my sample :

mean yhat, over(demo1)

This command produces a table of means of yhat for the 6 subgroups of
"demo1". I would like to create a variable that would contain these 6
values.


egen gpyhat = mean(yhat), by(demo1)

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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