Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Weighted proportion

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Weighted proportion Date Sat, 6 Oct 2012 17:30:26 -0400

```
What's the study design and purpose, Daniel?

Even if you don't have survey sample data, you can use
-svy: tabulate-
*******************************
sysuse auto, clear
svyset _n [pw = trunk]
//_n means primary sampling unit is individual observation
svy: prop rep78  // no need for [pw = ] option
svy: tabulate rep78, se ci
svy: tabulate  rep78 foreign, col se ci
*************************

If you _do_ have survey sample data, then
-svyset- according to the design.

Note that 'pw' = 'probability weight', which
reflects probability of selection and, informally,
is the number in the population represented by each
sampled observation.

Steve

On Oct 5, 2012, at 11:21 AM, Daniel Almar de Sneijder wrote:

Thank you all guys.

prop RRACE [pweight = RWEIGHT] and
tabulate RRACE [weight = RWEIGHT]

are both what I am looking for.
Thank you,
Daniel

On Fri, Oct 5, 2012 at 4:53 AM, Yuval Arbel <yuval.arbel@gmail.com> wrote:
> Steve, please take a look at Patrick's question:
>
> st: zoom on histograms
>
> and the links given there by Nick Cox.
>
> What Daniel asked in other words is a similar question: how to produce
> the numerical values from the histogram?
>
> On Thu, Oct 4, 2012 at 6:34 PM, David Kantor <kantor.d@att.net> wrote:
>> At 07:10 PM 10/4/2012, you wrote:
>>>
>>> Uhm yes, but that will give me the mean instead of the proportion...?
>>>
>>> On Thu, Oct 4, 2012 at 6:28 PM, kantor.d@att.net <kantor.d@att.net> wrote:
>>>> Have you tried
>>>> summarize rrace [weight=RWEIGHT]
>>>> ?
>>> [...]
>>>
>>>> Dear statalist,
>>>>
>>>> Any thoughts on a handy function or command to summarize the weighted
>>>> proportion? For instance, I have a variable that indicates to which
>>>> Race a respondent belongs. For example
>>>>
>>>> RRACE = 1 if Hispanic
>>>> RRACE = 2 if White
>>>> RRACE = 3 if Black
>>>> RRACE = 4 if Other
>>>>
>>>> Additionally I have a variable that weights the respondents (due to
>>>> oversampling of Hispanic's in my database), call this variable
>>>> RWEIGHT.
>>>>
>>>> Now I want to summarize the weighted proportions of RRACE, i.e. how
>>>> much % is Hispanic, White, etc.
>>> [...]
>>
>>
>> Of course, I "misspoke"; I meant tabulate.
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
>
> --
> Dr. Yuval Arbel
> 4 Shaar Palmer Street,
> Haifa 33031, Israel
> e-mail1: yuval.arbel@carmel.ac.il
> e-mail2: yuval.arbel@gmail.com
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```