-------------------------------------------------------------------------------
help for outtable                             (SSC distribution: 20 April 2008)
-------------------------------------------------------------------------------

Output matrix to LaTeX table

outtable using filename , mat(matrixname) [ replace append nobox center
caption("Caption") format(formatlist) norowlab longtable
label clabel(string)]

This command makes use of the file command, added to Stata on 8 May 2001.  If
file is not recognized, update query.

Description

outtable automates the conversion of a Stata matrix to a LaTeX table, written
to an external file. The table is presented with row and column names taken
from the specified matrix.  Thus, one need only generate the appropriate matrix
using standard Stata commands. By default, only the lower triangle of a
symmetric matrix will be written, as inferred by Stata's issym() function.

The using clause is required, and must specify the name of a file to which the
LaTeX table is to be written, without the .tex extension. If the file exists,
either the replace option or the append option must be specified.

The mat qualifier specifies the name of the existing matrix which is to be
written in tabular form.

Options

replace specifies that if filename exists, it should be overwritten with the
contents of mat.

append specifies that output should be appended to an existing filename.  It
may be used even if the file has not been previously created.

nobox specifies that the default behavior of providing borders for each cell of
the table should not be applied.

center specifies that elements in the second and following columns of the table
should be centered, rather than flush left.

asis specifies that the row and column names of mat should be passed through to
the TeX file without alteration. This permits use of the underscore (_) to
create subscripts in row or column headings. However, if the names of
regressors are being used as labels, the default label _cons should be
changed.

caption specifies a caption to be produced above the table. The table will be
automatically numbered according to the style of the document.

formatlist specifies the format to be applied to the elements in the body of
the table, which will then override the default format used to display
matrix elements.  If one value is specified, all columns are output with
that format.  If more than one space-delimited format is listed, they are
mapped 1-to-1 to the columns of the matrix.

norowlab suppresses the row labels.

longtable option allows to create tables that span over several pages using the
"longtable" package (do not forget to \usepackage{longtable} in the

label option allows to display variable labels (if they exist) instead of
variable names.

clabel allows you to enter the \caption{\label{ }} information which is used by
LaTeX for cross-referencing tables.  This option may be omitted and later

Examples

. use auto
. forv r=2/5 {
.      qui reg price headroom-turn if rep78==r'
.      mat cr'=e(b)'
.      }
.  mat c=c2,c3,c4,c5
.  mat colnames c=rep78_2 rep78_3 rep78_4 rep78_5

.  outtable using cars,mat(c) replace

.  outtable using cars,mat(c) append center f(%9.2f)

.  outtable using cars,mat(c) replace center f(%9.2f %9.3f %9.1f %9.2f)

.  outtable using cars,mat(c) replace c
cap("Regression coefficients by rep78")

Authors
Christopher F Baum, Boston College
baum@bc.edu

Joao Pedro Azevedo, Instituto de Pesquisa Economica Aplicada, Rio de Janeiro, B
> razil
jazevedo@ipea.gov.br

Acknowledgements
This command was made possible by Bill Gould's implementation of the file comma
> nd,
and inspired by conversations with Petia Petrova. Suggestions from David Drukke
> r,
Alan Feiveson and Nicholas J. Cox have improved its functionality. Formatting c
> ode was
borrowed from Blasnik and Jann's mat2txt.

Also see

On-line:  help for file, outseries (if installed), tosql (if installed)