Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Calculating group variances with weights
From
Stefan Gissler <[email protected]>
To
[email protected]
Subject
st: Calculating group variances with weights
Date
Sun, 21 Nov 2010 13:13:39 +0100
Hi,
I have an individual-level dataset where individuals are sorted by region and industry. Now I want to calculate the variance of the wages and various percentile ratios but I need to use weights and therefore the egen functions of sd and pctile do not work. So far I used nested loops, one loop over the regions and one over the indstry, used the summarize and _pctile commands and then created my variables from the results Stata stores in r(). The problem with this approach is that it takes really long, since I have several hundred regions. Is there any way to do this without loops and improve on efficiency?
Stefan
_________________________
Stefan Gissler
[email protected]
C/ de la Diputacio 315, 3-2B
08009 Barcelona
Spain
*
* 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/