Yesterday, I was trying to create tables from a survey dataset. With the number of variables (and the possibility that I will repeat the same process many more times), doing it by hand (i.e., copy-pasting results from -tab- to Excel), is not an option. For this task, I turned to Ian Watson’s -tabout-. This is probably the best Stata code that creates very neat tables and exports them into text files (that spreadsheets, such as Excel, can read). Since I am using a complex survey dataset, I checked if -svy- allows -tabout-, i.e, if I can write something like: svy, subpop(var): tabout vars…

This is not possible. But -tabout- has the svy option that makes use of the survey design variables specified in -svyset-. First problem solved.

My second problem was how to generate estimates for subsamples using -tabout-. In

Use subpop() to generate subsample estimates using a survey data, we said that using the subpop() -svy- option, not the -if- qualifier, provides the correct standard errors. But -tabout- does not have a subpop option, only the -if- and -in- qualifiers. Fortunately, when using the svy option in -tabout-, the -if- and -in- qualifiers works the same as the subpop option (see note below). Second problem solved.

To install -tabout-, type:

**ssc install tabout**
The -tabout- command — how to use, problems/erors in using, etc. — is well discussed in

Statalist**. **The best way to start learning about -tabout- is by reading

Publications quality tables in Stata: a tutorial for the tabout program (Watson 2007).

Note: Thanks to

Ian Watson for pointing out footnote #3 (which I have missed) in

Publications quality tables in Stata: a tutorial for the tabout program, page 3.

*Related*

Filed under: Basic functions, Econometrics / Statistics, Survey Tagged: | subpop, svy, tabout

Marizza, on 26 June 2015 at 10:40 PM said:I found a diference in standar error and confidence intervals estimation using the svy command y the tabout command (with svy option). Have anyone else found this diference?

Robert, on 6 June 2013 at 10:57 PM said:Hi. I am just getting introduced to the tabout feature. It looks great I am interested in producing publication-quality chi-square tables, but my output in Word is improperly formatted. Can anyone offer guidance on proper command? I am a bit confused on how to use the col, layout, and other commands to improve presentation in Word. Excited at not having to copy and paste though a hundred tables. Here is the command I am using: tabout varname varname using memo1, stats(chi)

Ehlinger, on 4 July 2011 at 11:17 PM said:I have tried to use tabout with “svy” option for twoway tables (tabout X Y using …, stats(chi2) svy …”) on STATA 11 and it worked well.

My problem is that the estimated “Uncorrected Pearson chi2(2) ” and the “Design-based F” differ from what I found when using the command “svy : tab X Y”.

My analysed population is exactly the same. And surprisingly, the p-values for the design-based Pearson Chi square test are the same.

Can anyone explain me the discrepancies between tabout with svy and “svy : tab …” ?

Thanks a lot

Mitch Abdon, on 5 July 2011 at 9:08 AM said:Hi. As I know the answer to your question. I suggest you email Ian Watson (mail@ianwatson.com.au), the author of -tabout-.

Or, post at Statalist. There is a much much bigger chance of getting an answer there.

Mitch

Ehlinger, on 5 July 2011 at 3:31 PM said:Sorry for my post yesterday : the difference I found came from the utilization of “if” in me “svy : tab …” command. I should have read your first post more carefully !

FIONA, on 10 May 2011 at 10:15 PM said:I have tried to get population numbers using the npos(lab) option and svy in tabout but it gives me sample numbers. When I add pop, I get an error. When I add nwt (weight), I get no numbers at all and besides svyset has already specified my weight so I don’t need to mention it again I guess. What should I do?

Mitch Abdon, on 11 May 2011 at 9:20 AM said:Just in case, is your -tabout- updated? The pop option is only available in version 2.0.4 (see p.28 of Publications quality tables in Stata: a tutorial for the tabout program (Watson 2007).