Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Austin Nichols <austinnichols@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: AW: creating variable from svy: proportion |
Date | Mon, 3 May 2010 11:19:41 -0400 |
Guy Grossman: Try also: webuse nhanes2, clear svy:tab region heartatk, row ci ssc inst _gwtmean egen m=wtmean(heartatk), by(region) weight(finalwgt) ta region, sum(m) On Mon, May 3, 2010 at 11:01 AM, Maarten buis <maartenbuis@yahoo.co.uk> wrote: > --- On Mon, 3/5/10, Guy Grossman wrote: >> sorry for not being sufficiently clear. using the official example at >> I wish to create a variable which is equivalent to the >> proportion of female by race at the county level. meaning all the >> observations within the same county will receive the same value of this >> proportion. > > The easiest way is probably to use -regress- on your dummy variable, > followed by -predict-. A proportion is nothing other than the mean > of an indicator variable, so that is why you can use -regress-, and > -regress- allows the -svy- prefix. > * * 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/