-------------------------------------------------------------------------------
help for outtable                        (StataList distribution: 12 June 2003)
-------------------------------------------------------------------------------

Output matrix to LaTeX table

outtable using filename , mat(matrixname) [ replace append nobox center caption("Caption") format(format) norowlab nosym ]

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 unless the nosym option is used.

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.

format 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.

norowlab suppresses the row labels.

nosym forces the matrix to be treated as general, and not symmetric.

Examples

. use auto . forv r=2/5 { . qui reg price headroom-turn if rep78==`r' . mat c`r'=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 c cap("Regression coefficients by rep78") Author Christopher F Baum, Boston College, baum@bc.edu

Acknowledgements This command was made possible by Bill Gould's implementation of the file comma > nd, and inspired by conversations with Petia Petrova. David Drukker's and Alan Feiv > eson's suggestions have improved its functionality.

Also see

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