Statalist


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

st: computing means and quantiles for groups using weights


From   "Paolo Naticchioni" <paonat.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: computing means and quantiles for groups using weights
Date   Mon, 16 Jul 2007 12:22:26 +0200

dear all,
my question s the following.
I want to create a new variable including the means for some groups
(strata) of the population.
For instance, assume my strata are year, gender, education.

Using egen I can compute the average of some outcome variable, for
instance wage, using the following:

bysort year gender education: egen average=mean(wage)

However, using egen I cannot use any types of weights. I would like to
use weights (weights with average 1). Do you know how can I introduce
weights in a easy way? Probably it is very easy, but I do not know the
command.

I would like also to compute some quantile of the distribution, like
the 10th quantile, the median, the 90th percentile, etc.
Also in this case, I can use egen
bysort year gender education: egen p90=pctile(wage), p(90)

However, also in this case it is not possible to use weights, the
consider the weighted distribution.

Someone knows how to do all that?
thanks
Paolo
PS I have also used collapse, but also in this case it is not possible
to use weights for means or for quantiles
*
*   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