Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: one-way tables with survey data


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: one-way tables with survey data
Date   Tue, 14 Jun 2005 18:40:22 -0400

Please check help before posting: -whelp svytab- shows that svytab does allow a row option to have it display row percentages instead of cell percentages. Unlike tabulate, svytab does not allow you to abbreviate row with just r.

Also, your solution of using -if- will give incorrect standard errors with svy data, you would need to use subpop() instead so that the full sample design is taken into account for a subpopulation.

You may also want to check out -svytabs- which I wrote a while ago that creates more complicated svy cross tabs allowing tabulation of multiple variables against a common variable, multiple subpops, starred significance levels and many other additions that may be of interest to you. It produces comma delimited files of results. Type -findit svytabs- and you will be led to SSC.

Michael Blasnik
[email protected]


----- Original Message ----- From: "Steven A. Harvey" <[email protected]>
To: <[email protected]>
Cc: "Saifuddin Ahmed" <[email protected]>
Sent: Tuesday, June 14, 2005 5:38 PM
Subject: Re: st: one-way tables with survey data



Nick Winter's answer works very well for unstratified variables (Thank you, Nick). This solves part of my problem, but not all of it. For many variables, I need to stratify by respondent characteristics. For example, if I want to stratify by age in a non-survey dataset, I could type:

tab agegrp myvar , r

and Stata would return percentages that add up to 100% for each row, with each row corresponding to a different age group.

but svytab doesn't allow the , r option, and when I type

svytab agegrp myvar

Stata returns a table of proportions in which the rows and columns combined add up to 1. I can't figure out a way to get row totals.

svytab also does not allow "by" statements, so I can't say "bysort agegrp: svytab myvar one" (where "one" is the constant variable mentioned in Nick's message)

The only workaround I've been able to discover so far is to use an "if" statement for each stratum:

svytab myvar one if agegrp==1
svytab myvar one if agegrp==2
svytab myvar one if agegrp==3

etc.

Very cumbersome and time-consuming, especially for characteristics with many strata (e.g., 17 provinces in the country)
This syntax also prevents me from using the syntax "for varlist varA varB varC etc: svytab X myvar"

Surely there must be a more efficient way to produce such basic information...?

Thanks again,

Steve

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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