Statalist


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

st: calculating means by group, with weights


From   Gisella Young <gisellayoung@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: calculating means by group, with weights
Date   Wed, 25 Jun 2008 09:09:10 -0700 (PDT)

Hi,

I am trying to calculate the mean of a variable ("income") across groups ("bracket"), but using the relevant survey weights (variable "weight"). I tried saying:

bys bracket: egen float meanincome = mean(income) [fweight=weight]

but this is not possible since the egen command does not allow for weighting. This is a problem for me as if I do not use the weights the means will be wrong. 

Is there any way of doing this?

Thank you in advance...

Gisella


      

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