Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: superrows for tabout


From   Eric Booth <ebooth@ppri.tamu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: superrows for tabout
Date   Wed, 21 Oct 2009 09:18:45 -0500

See this document from the author of -tabout-: http://www.ianwatson.com.au/stata/tabout_tutorial.pdf . Pgs 13-15 show some good examples of creating supercolumns using the "cl" options of -tabout-, however this is only for latex, I haven't found a way to export this directly to excel/word from -tabout-.

Another possibility is using -tab3way- and -logout-, however, even if you work on cleaning the log as the author describes in the help file, you'll probably still need to tweak the output file in excel (e.g., merging the column header cells or deleting extra rows). Currently, -logout- does not mention -tab3way- as one of the commands it works nicely with --here's an example that gets you pretty close to exporting a 3 way table to excel:
****************
clear
ssc install tab3way
webuse auto
logout, save(myfile) excel replace: tab3way mpg rep78 for , rowtot coltot
**or**
logout, save(myfile2) excel fix(1) replace: tab3way mpg rep78 for , rowtot coltot
************
Finally, you want to use -tabdisp- instead. -tab3way- uses -tabdisp- to help display the table with supercolumns, and -tabdisp- has less output to clean up (e.g., extra rows at the top of the table) in a - logout- scenario (though it also doesn't have all the cell display options that -tab3way- has). You could try the example above with this instead:
**
logout, save(myfile3) excel fix(1) replace: tabdisp mpg rep78 for, c (price) center concise
**
Hopefully others will suggest a cleaner solution to getting 3 way tables into word/excel--I'd be interested in them as well.


Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754



On Oct 21, 2009, at 6:08 AM, Thomas wrote:

Dear all,

is there a way to add superrows to tabout? As an example I want to
tabulate summary statistics across years by firm and state:

State A
  Firm 1
  Firm 2
Total

State B
  Firm 3
  Firm 4
Total
....

Many thanks,

Thomas

*
*   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/



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