Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: update to -tabout-

From   Ian Watson <>
To   statalist <>
Subject   st: update to -tabout-
Date   Mon, 29 Nov 2004 07:58:14 +1100

Dear statalist,

  Thanks top Kit Baum, a new version of -tabout- is now available from
  the SSC archives. From inside Stata just type:  ssc install tabout
  (or: ssc install tabout, replace).

  -tabout- produces publication quality tables from Stata, with the
  output exported to a text file. It can be exported as tab-delimited,
  html code or LaTeX/TeX code. -tabout- provides extensive user
  control over formating of data and labels and generates table
  headers automatically.

  This version includes:

  - frequency tables
  - tables of summary statistics (similar to -table-)
  - tables of percentile ratios
  - chi2 statistics

  The earlier version provided the usual cross-tabulations (similar to
  -tabulate-). One feature of -tabout- is the ability to produce
  stacked tables, for example, multiple vertical variables
  cross-tabulated against a horizontal variable.
  For complex formating, user "style" files can be specified which
  insert code above and below the tables for greater control over the
  appearance. Arguments can be passed to these files at run-time,
  allowing users to specify titles and so forth for their tables.

  This version is a complete rebuild of the earlier -tabout-, with
  considerable changes to the syntax. Users of the former version
  should consult the help file to ensure they now make use of the new
  syntax.  A few nasty bugs have been fixed. Sorry to any users who
  have been bitten. Bug reports are, of course, very welcome.

  To make learning the syntax easy, some example files are available

  These illustrate the appearance of the tables as well as the details
  of the syntax used to produce them.


-tabout- should meet the needs of two stata listers who recently
posted queries about producing tables.
Friedrich Huebler <> asked how he might
produce a table in tab delimited form that looked like this:

Group        Median
Male           $XXX
Female         $XXX
Primary ed.    $XXX
Secondary ed.  $XXX
Higher ed.     $XXX
Urban          $XXX
Rural          $XXX
New Jersey     $XXX
New Mexico     $XXX
New York       $XXX
Total          $XXX

Using -tabout- for this task, the syntax could be as simple as:

   tabout sex education geog state using myfile.txt, replace ///
   cells(median income) oneway format(%9.0f)

Michael and Rita C. Carlberg <> also recently asked how
they might get a table with the following numerical formatting:

   Fraga16 |      Freq.     Percent        Cum.
          1 |        137       20          20
          2 |        353       51          71
          3 |         92       13          85
          4 |         71       10          95
          5 |         20        3          98
          9 |         10        1         100
        999 |          3        0         100
      Total |        686      100

Using -tabout- they need only type:

tabout Frag16 using myfile.txt, replace ///
cells(fcount fper fcum) format(%9.0f %9.0f %9.0f)

And, if they wanted different formatting for each column, they could
change the format option as required, for example:
format(%9.0fc %9.1f %9.2f).

Kind regards,

Ian Watson
Senior Researcher
University of Sydney
NSW 2006

Phone: 02 9351 5622
  Fax: 02 9351 5615


*   For searches and help try:

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