Put anything anywhere in Excel without sweat

putexcel has recently become a very good friend. For those who (or working with people who) find comfort in working with tables in Excel after data processing or estimation in Stata (yes, there are others who don’t find comfort in this.) and already into Stata 13, learning putexcel could be very helpful (put an end to copy-pasting!). A number of user-written commands, such as outreg [1], outreg2, tabout, are also already available for similar purposes. What puts putexcel apart is its ‘user-friendliness’ and flexibility. You can put anything anywhere in Excel without sweat.

Continue reading

-tabout- and -svy-

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.