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

st: RE: calculating means by group, with weights

From   "Nick Cox" <>
To   <>
Subject   st: RE: calculating means by group, with weights
Date   Wed, 25 Jun 2008 17:36:22 +0100

A different issue: shouldn't survey weights be pweights? 

-----Original Message-----
From: Nick Cox 
Sent: 25 June 2008 17:23
To: ''
Subject: RE: calculating means by group, with weights

This is an FAQ. 

FAQ     . . Calculating variables containing weighted group summary
        . . . . . . . . . . . . . . . . . . . . .  N. J. Cox and S. P.
        1/03    I want to calculate a variable containing weighted
                group summary statistics, but I do not want to
                collapse the data and egen does not support weights.
                How can I do this?

Gisella Young

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. 

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index