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

Re: st: SVY: tab with three variables

Subject   Re: st: SVY: tab with three variables
Date   Fri, 1 May 2009 11:15:21 -0400

Welcome to Stata!  Reposting a question will not get it answered any
faster.  See the Stata FAQ about why questions do not get answered.
In your case, your post is hard to read. Your questions are mixed up
with snippets of Stata code, and other  statements.

Important! Something appears wrong with your survey set up.  You have
n =  5,191 observations, but Stata reports that the total population
size is only N = 3,061,  You could be using the wrong probability
weight. Stop and fix this problem.

To answer your questions.

1. If you have survey data, you must always -svyset- with the
appropriate setting.  Consult your advisor if you do not understand
why, or look at Sharon Lohr, "Sampling, Design and Analysis", Duxbury

2. Your new race-ethnicity variable seems okay.  You can
cross-tabulate it against the original variable to check.

You have a potential problem if whites were not asked this question:
the survey weights might give misleading results if applied to
nonwhites alone.  This is not an elementary matter and you should
consult someone who is knowledgeable about surveys for advice.  Bring
the study documentation with you when you do this.

3.  -svy: tab- with the tab() option doesn't do what you think it
does.   Read the -help- to see why.

I'm assuming that the new race-thnic variable is recoded 1 & 2.

svy, subpop(if racethn==1), tab sex psymps, row
svy, subpop(if racethn==2), tab sex psymps, row


On Fri, May 1, 2009 at 10:01 AM, Adebola Odunlami
<> wrote:
> Hi all,
> I was hoping someone would please address my question below. Any help/insight is greatly appreciated.
> thanks in advance.
> I am relatively new to stata and I have a few related questions. I want to get proportion of units that answered a question( variable name = psysymps) by thier gender(sex) and race (race3cat) after I survey set the data. I tried "bysort race3cat: tab psysymps sex, row col chi2"  but then realized the percentages were off and I needed to use svy commands. I then tried "svy: tab racet3cat sex, tab (psysymps) row se ci" but got a response that the table contains 0 in the marginals and therefore statsitics cannot be computed. I realized that one of the race categories (e.g. White) was not asked the question. So I created a new race category ("blackethn) that sets Whites to missing and others to either 1 or 2. Then I proceeded with my primary objective to see proportions of 'psysymps' by race and sex and tried "svy: tab blackethn sex, tab (psysymps) row se ci". This gave me the table below.
> My questions are: 1) must I always svy set before each code e.g svy: tab instead of just tab?; 2) was it okay to set Whites to missing as they were not asked this question and I dont want them counted as a denominator in my proportion?; 3) the table below still does not give me tabs of my variable by race and sex. how do I do this? Instead the table gave me---of those who answered yes to psysymps, what proportion of race/blackethn =1 were men and what prop were women? I would like to know how to code to get----what proportion of race/blackethn==1 men answered 'yes' to psysymps, compared to race/blackethn== 1 female (and also the proportion of race/blackethn ==2 men that answered yes to to psysymps, compared to race/blackethn== 2 female and associated chi2)
> Number of strata   =        41                  Number of obs      =      5191
> Number of PSUs     =        88                  Population size    = 3061.3339
>                                               Design df          =        47
> -------------------------------------------------------
>         |                   rs sex
> blackethn |          male         female          Total
> ----------+--------------------------------------------
>       1 |         .4019          .5981              1
>         |       (.0248)        (.0248)
>         | [.3532,.4526]  [.5474,.6468]
>         |
>       2 |         .5338          .4662              1
>         |       (.0579)        (.0579)
>         | [.4176,.6465]  [.3535,.5824]
>         |
>   Total |         .4101          .5899              1
>         |       (.0235)        (.0235)
>         | [.3638,.4581]  [.5419,.6362]
> -------------------------------------------------------
>  Tabulated variable:  psysymps
>  Key:  row proportions
>       (linearized standard errors of row proportions)
>       [95% confidence intervals for row proportions]
>  Pearson:
>   Uncorrected   chi2(1)         =   21.8483
>   Design-based  F(1, 47)        =    4.6397     P = 0.0364
> Thanks so much in advance for your time
> Adebola Odunlami, MPH
> Doctoral Student
> Society, Human Development and Health
> Harvard School of Public Health
> 301 256 4655
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index