Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Stefan Gissler <stefan.gissler@googlemail.com> |
To | statalist@hsphsun2.harvard.edu |
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 stefan.gissler@gmail.com 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/