Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: creating variable from svy: proportion


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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index