Doubtless, there are many ways to accomplish your task using Stata. Let's
say you want rows, columns, and supercolumns. One strategy is to generate
the data series you need -svytab- with the -subpop- option, then save the
results using -file- or -postfile-, and then finally load the new datafile
and display the results using -tabdisp- or -table-. It may seem like a lot
of work, but the code is highly re-usable. Also, although it won't be an
issue with Stata 8's new graphics, it is nice to have the results in a
separate file so they can be graphed outside of Stata.
You will probably need to create a variable to specify each combination of
columns and supercolumns. Then use loops and the -subpop()- option of
-svytab- to generate your data. Essentially you will be replicating the
behaviour of -table, replace-.
One catch in doing it this way is that Stata doesn't save the 95% CI of your
estimates in the -svytab- matrix. You have to calculate it yourself from the
standard error (which is in a matrix). You can use something like this (the
indexing [] may be a little different depending on how you generate the
table):
local df = e(df_r)
local N = e(N)
matrix myV = e(V)
local se = sqrt(myV[1,1])
matrix myb = e(b)
local est = myb[1,2]
* Upper Confidence Limit
local up = log(`est'/(1-`est')) +
((invttail(`df',0.025)*`se')/(`est'*(1-`est')))
local upci = exp(`up')/(1+ exp(`up'))
* Lower Confidence Limit
local lo = log(`est'/(1-`est')) -
((invttail(`df',0.025)*`se')/(`est'*(1-`est')))
local lowci = exp(`lo')/(1+ exp(`lo'))
With all of the cell proportions and CIs for your table properly calculated
using -svytab- and stored in a new datafile, you just need to use -table- or
-tabdisp- to display results.
Regards,
Lee
Lee Sieswerda, Epidemiologist
Thunder Bay District Health Unit
999 Balmoral Street
Thunder Bay, Ontario
Canada P7B 6E7
Tel: +1 (807) 625-5957
Fax: +1 (807) 623-2369
[email protected]
www.tbdhu.com
> -----Original Message-----
> From: Shinogle, Judy [SMTP:[email protected]]
> Sent: Tuesday, January 07, 2003 1:40 PM
> To: STATA LIST SERVE (E-mail)
> Subject: st: tabulate survey data
>
> Is there a way to do three (and other higher order cross tabs) way tables
> or a command similar to tabulate for survey data?
>
> Judith A. Shinogle, Ph.D., MSc.
> Assistant Professor
> University of South Carolina
> Dept. of Health Administration,
> Norman J. Arnold School of Public Health
> Dept. of Pharmaceutical and Health Outcomes Sciences, College of Pharmacy
> Columbia, SC 29208
> phone (803) 777-5727
> [email protected]
>
> *
> * 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/
*
* 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/