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]

From |
Tim Scharks <tim.scharks@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: tabulate, summarize() for svy data |

Date |
Thu, 18 Mar 2010 09:51:28 -0700 |

Hi Ricardo, sorry, I am not clear if Nick's answer is "no" or not so I am forging ahead...to my *inexpert* knowledge you can't run the summarize() subcommand with svy:tabulate, I presume because it's fairly memory intensive to calculate even the means for survey data subpopulations. What I have done instead is to tabulate the variable I am curious about, then write a foreach loop that loops through each distinct value of the variable to find the summary stat I want and write the list to a file (you could just -display- it to your screen, too): file open rankings using rankingstext.txt, write replace foreach x in /// "AR" /// "AZ" /// "WI" /// "WV" /// "WY" { svy:mean meth_ever if state==`"`x'"' file write rankings `"`x'"' _tab (_b[meth_ever]) _n } if you have a large number of values you should run levelsof and then run foreach on r(levels). PLEASE NOTE that the above estimation will give you reliable means from your survey population but inefficient standard errors: If you need good confidence intervals for means on subpopulations you must 1) create a dummy variable for each population of interest, for instance for 50 states you would need 50 dummy variables (instead of the usual 49) each for AK==1, AR==1, AZ==1, etc. If you had another dichotomous variable that you need a dummy for EACH interaction (e.g. AK*male==1, AK*female==1, ...) 2) Run the above on every dummy variable as the specified subpopulation: gen AK_male=AK*male gen AK_female=AK*female svy, subpop(AK_male): mean meth_ever svy, subpop(AK_female): mean meth_ever again, if you have a large number of interactions you might use xi but note you will still have to create a dummy for the leaveout that xi creates. This is because -svy, subpop():- will only use the 0 values for the leaveout in its calculations. Hope that helps! If anyone knows faster/better ways to get the same kind of info from survey data that tabulate, summarize() does, please let me know!! Thanks, Tim > On Thu, Mar 18, 2010 at 8:17 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote: >> >> . search survey tabulate >> >> Keyword search >> >> Keywords: survey tabulate >> Search: (1) Official help files, FAQs, Examples, SJs, and >> STBs >> >> Search of official help files, FAQs, Examples, SJs, and STBs >> >> >> [SVY] svy: tabulate oneway . . . . . . . . . One-way tables for >> survey data >> (help svy: tabulate oneway) >> >> [SVY] svy: tabulate twoway . . . . . . . . . Two-way tables for >> survey data >> (help svy: tabulate twoway) >> >> FAQ . How can I analyze a subpopulation of survey data in Stata 9 >> and 10? >> . . . . . . . . . . . . . . . . . . UCLA Academic Technology >> Services >> 7/08 >> http://www.ats.ucla.edu/stat/stata/faq/svy_stata_subpop.htm >> >> Example . . . . Textbook examples: Applied Logistic Regression (2nd >> Edition) >> . . . . . . . . . . . . . . . . . . UCLA Academic Technology >> Services >> 2/08 examples from the book Applied Logistic Regression >> (2nd Edition) by David Hosmer and Stanley Lemeshow >> http://www.ats.ucla.edu/stat/stata/examples/alr2/ >> >> Example . . . . . . Textbook examples: Elementary Survey Sampling, 5th >> Edition >> . . . . . . . . . . . . . . . . . . UCLA Academic Technology >> Services >> 10/05 examples from the book Elementary Survey Sampling, >> Fifth Edition by Richard Scheaffer, William >> Mendenhall, & Lyman Ott >> http://www.ats.ucla.edu/stat/stata/examples/ess5/ >> >> Example . . . . . . . . . . . Textbook examples: Sampling: Design and >> Analysis >> . . . . . . . . . . . . . . . . . . UCLA Academic Technology >> Services >> 4/05 examples from the book Sampling: Design and >> Analysis by Sharon L. Lohr >> http://www.ats.ucla.edu/stat/stata/examples/lohr/ >> >> Nick >> n.j.cox@durham.ac.uk >> >> Ricardo Ovaldia, MS >> >> Is there a command similar to -tabulate, summarize()- for survey data? >> I could not findit in the help file >> >> >> * >> * 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/ > * * 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/

**References**:**Re: st: strange -multproc- results***From:*Roger Newson <r.newson@imperial.ac.uk>

**st: tabulate, summarize() for svy data***From:*Ricardo Ovaldia <ovaldia@yahoo.com>

**st: RE: tabulate, summarize() for svy data***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: Estout after xtmixed with ar(1) residuals** - Next by Date:
**st: RE: efficient file organization for programming** - Previous by thread:
**st: RE: tabulate, summarize() for svy data** - Next by thread:
**Re: st: tabulate, summarize() for svy data** - Index(es):