help frmt_opts
-------------------------------------------------------------------------------

text additions Description --------------------------------------------------------------------------- varlabels use variable labels as rtitles title(textcolumn) put title above table ctitles(textgrid) headings at top of columns rtitles(textgrid) headings to the left of each row note(textcolumn) put note below table pretext(textcolumn) regular text placed before the table posttext(textcolumn) regular text placed after the table nocoltitl no column titles norowtitl no row titles addrows(textgrid) add rows at bottom of table addrtc(#) number of rtitles columns in addrows addcols(textgrid) add columns to right of table annotate(Stata matrix name) grid of annotation locations asymbol(textrow) symbols for annotations ---------------------------------------------------------------------------

column formatting Description --------------------------------------------------------------------------- colwidth(numlist)* change column widths multicol(numtriple[;numtriple ...]) have column titles span multiple columns coljust(cjstring[;cjstring ...]) column justification: left, center, right, or decimal nocenter Don't center table within page --------------------------------------------------------------------------- * Word-only option

font specification Description --------------------------------------------------------------------------- basefont(fontlist) change the base font for all text titlfont(fontcolumn) change font for table title ctitlfont(fontgrid[;fontgrid...]) change font for column titles rtitlfont(fontgrid[;fontgrid...]) change font for row titles statfont(fontgrid[;fontgrid...]) change font for statistics in body of table notefont(fontcolumn) change font for notes below table addfont(fontname)* add a new font type plain plain text - one font size, no justification table sections explanation of formatted table sections --------------------------------------------------------------------------- * Word-only option

border lines and spacing Description --------------------------------------------------------------------------- hlines(linestring) horizontal lines between rows vlines(linestring) verticle lines between columns hlstyle(lstylelist)* change style of horizontal lines (e.g. double, dashed) vlstyle(lstylelist)* change style of verticle lines (e.g. double, dashed) spacebef(spacestring) put space above cell contents. spaceaft(spacestring) put space below cell contents. spaceht(#) change size of spacebef & spaceaft. --------------------------------------------------------------------------- * Word-only option

page formatting Description --------------------------------------------------------------------------- landscape pages in landscape orientation a4 A4 size paper (instead of 8 1/2” x 11”) ---------------------------------------------------------------------------

file and display options Description --------------------------------------------------------------------------- tex write a TeX file instead of the default Word file merge[(tblname)] merge as new columns to existing table replace replace existing file addtable write a new table below an existing table append[(tblname)] append as new rows below an existing table replay[(tblname)] write preexisting table store(tblname) store table with name "tblname" clear[(tblname)] clear existing table from memory fragment** create TeX code fragment to insert into TeX document nodisplay don't display table in results window dwide display all columns however wide --------------------------------------------------------------------------- ** TeX-only option

brackets options Description --------------------------------------------------------------------------- squarebrack square brackets instead of parentheses brackets(textpair [ \ textpair ...]) symbols with which to bracket substatistics nobrket put no brackets on substatistics dbldiv(text) symbol dividing double statistics ("-") ---------------------------------------------------------------------------

Inline text formatting: superscripts, italics, Greek characters, etc.

+----------------+ ----+ Text additions +---------------------------------------------------

varlabels replaces variable names with variable labels in row and column titles, if the variable labels exist. For example, if using the auto.dta data set, varlabel gives a coefficient for the mpg variable the row title "Mileage (mpg)" instead of "mpg". varlabels also replaces "_cons" with "Constant" for constant coefficients.

Text structures used for titles textcolumn is "string" [\"string"...] textrow is "string" [,"string"...] textgrid is "string" [,"string"...] [\ "string"[,"string"...] [\ [...]]] or a textrow or a textcolumn as a special case "string" ["string" ...] will often work in place of a textrow or a textcolumn when the user's intent is clear, but if in doubt use the proper textrow or textcolumn syntax above.

title(textcolumn) specifies a title or titles above the table. Subtitles should be separated from the primary titles by backslashes ("\"), like this: title("Main Title" \ "First Sub-Title" \ "Second Sub-Title"). By default, titles are set in a larger font than the body of the table. If title text does not contain backslashes, you can dispense with the quotation marks, but if in doubt, include them.

ctitles(textgrid) specifies the column titles above the statistics. A simple form of ctitles is, for example, ctitles("Variables", "First Regression"). Note that if there is a column of row titles, the first title in ctitles goes above this column and the second title goes above the first statistics column. If you want no heading above the row titles column, specify ctitles("", "First Regression").

Fancier titles in ctitles can have multiple rows. These are specified as a textgrid. For example, to put a number above the column title for the estimation method using outreg (in preparation for merging additional estimation results), one could use ctitles("", "Regression 1" \ "Independent Variables", "OLS"). The table would now have a first column title of "Regression 1" above the coefficients estimates, and a second column title of "OLS" in the row below.

See outreg Example 10 for an application of multi-row ctitles.

The option nocoltitl removes even the default column titles.

rtitles(textgrid) fills the leftmost column of the table with new row titles for the statistics. In outreg, the default row titles (with no rtitles option) are variable names. Multiple titles for the leftmost column in rtitles should be separated by "\" since they are placed below one another (if the titles are separated with commas, they will all be placed in the first row of the estimates). An example of rtitles in outreg is rtitles("Variable 1" \ "" \ "Variable 2" \ "" \ "Constant"). The empty titles "" are to account for the t statistics below the coefficients.

Multicolumn rtitles are possible, and will be merged correctly with other estimation results. Multicolumn rtitles occur by default, without a specified rtitle, after multi-equation estimations, where the first rtitle column is the equation name, and the second rtitle column is the variable name within the equation. See the second part of outreg Example 6 for a table showing this.

The option norowtitl removes even the default row titles.

note(textcolumn) specifies a note to be displayed below the formatted table. Multiple lines of a note should be separated by backslashes ("\"), like this: note("First note line." \ "Second note line." \ "Third note line."). Notes are centered immediately below the table. By default, they are set in a smaller font than the body of the table. Blank note lines ("") are possible to insert space between note rows.

pretext(textcolumn) regular text placed before the table. posttext(textcolumn) regular text placed after the table. pretext and posttext contains regular paragraphs of text to be placed before or after the formatted table in the document created. This allows a document to be created with regular paragraphs between the tables. The default font is applied, which can be changed with the basefont option. Text is left justified and spans the whole page.

Multiple paragraphs can be separated by the backslash character: pretext("Paragraph 1" \ "Paragraph 2").

When creating a Word document, you can create blank lines with empty paragraphs: e.g. posttext("" \ "" \ "This is text") would create two blank lines before the paragraph "This is text".

For Word documents, you can also use the code "\line" for blank lines. You can insert page breaks between tables with the Word code "\page" in pretext("\page"), which is useful when placing multiple tables within one document with the addtable option. The page break or line break codes can be used within a text string, but they must have a space between the codes and the subsequent text: e.g. pretext("\page\line This is text"). Without the space, in pretext("\page\lineThis is text"), Word would try to interpret the code "\lineThis" which is not defined.

When creating a TeX document (using option tex), you can insert blank lines using the code "\bigskip" (the trick used above of inserting blank paragraphs does not work in TeX files). You can insert page breaks between tables with the code "\pagebreak", as in pretext("\pagebreak"), which is useful with the addtable option to put each table on a separate page. The page break or line break codes must be in separate rows from text: e.g. pretext("\pagebreak\bigskip" \ "This is text").

nocoltitl ensures that there are no column titles - the default column title of the dependent variable name is not used. To replace the column headings, instead of eliminate them, use ctitles.

norowtitl ensures that there are no row titles at all - the default row titles not used. To replace the row headings, instead of eliminate them, use rtitles.

addrows(textgrid) adds rows of text to the bottom of the table (above the notes). All elements of the rows must be converted from numbers to text before including in the textgrid. For example, to include the test results of coefficient equality, you could use addrows("t test of b1=b2", "`ttest' **") where "ttest" is the name of a local macro with the value of the t test of ceofficient equality. The asterisks are included because the t test was significant at the 5% level.

See outreg Example 7 for an application of addrows.

addrtc(#) is a rarely used option to specify the number of rtitle columns in addrows. It is only needed when either rtitles or addrows has more than one column to ensure that the row titles are lined up correctly vis-a-vis the data. By default, addrtc is equal to 1.

addcols(textgrid) adds columns to the right of table. The contents of the new columns are not merged - it is the user's responsibility to ensure that the new columns line up in the appropriate way.

annotate(Stata matrix name) passes a matrix of annotation locations. asymbol(textrow) provides symbols for each annotation location in annotate.

annotate and asymbol (always specified together) are useful for placing footnotes or other annotations next to statistics in the formatted table, but they are not the most user-friendly. (Footnotes or annotations in any of the title regions, including row and column titles, can be included directly in the title text with options like rtitles and ctitles.)

The values in annotate range from 0 to the number of symbols in asymbols. In the case of outreg the dimensions of the matrix in annotate has rows equal to the number of coefficients in the estimation, and columns equal to the number of statistics displayed (2, by default). Whenever the annotate matrix has a value of zero, no symbol is appended to the statistic in the corresponding cell of the table. Where the annotate matrix has a value of 1, the first asymbol symbol is added on the left of the statistic, where there's a value of 2, the second symbol is added, etc.

The textrow in asymbols has the syntax "text"[, "text" ...]]. If you want to have a space between the statistic in the table and the asymbol text, make sure to include it in the text, e.g. asymbols(" 1"," 2"). Superscripts for the symbols in a Word file can be included as follows: enclose the symbol with curly brackets "{}" and prepend the superscript code "\super ". So for a superscript one, the text in asymbols would be "{\super 1}". Make sure to include the space after "\super". For TeX files, "1" can be superscripted either with the code "$^1$" or "\textsuperscript{1}". See the discussion about inline formatting.

To understand the correspondence between the locations in the annotate matrix and the final formatted table, it helps to know how the frmttable program (called by outreg and other programs) creates tables. In the case of outreg, it sends the different estimation statistics in separate columns, so for the default statistics of b and t_abs, outreg sends a K by 2 matrix to frmttable, where K is the number of coefficients. The nonzero locations of annotate that indicate a symbol should be added correspond to the locations of the K by 2 matrix passed to frmttable, not the 2K by 1 table of statistics created by frmttable. Perhaps a simpler way of saying this is that annotate positions correspond to the final table positions when you use the nosubstat option. If there are S statistics (2 by default), the annotate matrix should be a K by S Stata matrix where K is the number of columns in e(b). This can be created in a Stata for a regression with 5 coefficients and the default of 2 statistics like this: . matrix annotmat = J(5,2,0) . matrix annotmat[1,1] = 1 . matrix annotmat[3,2] = 2 . outreg ... , annotate(annotmat) asymbol(" (1)"," (2)") This will assign the first asymbol (" (1)") to the first coefficient, and the second asymbol (" (2)") to the third t statistic.

In fact, the annotate matrix can be smaller than K by S if there are rows at the bottom of the table or columns on the right of the table that don't need any symbols. In other words, if the annotate matrix is not the same size as the statistics, the missing, or too large, parts of it are ignored.

If annotate and asymbol are used to create footnote references, the footnotes themselves can be included in the note option.

See outreg Example 14 for an application of annotate and asymbol.

+-------------------+ ----+ Column formatting +------------------------------------------------

colwidth(numlist) assigns column widths. By default, the program makes its best guess of the appropriate column width, but Word RTF files have no algorithm to ensure that the column width exactly fits the maximum width of the contents of its cells, the way TeX files do. In particular, when special non-printing formatting codes (such as superscript codes) are included in ctitles and rtitles, the program will probably get the width wrong, and colwidth will be needed. This option is only allowed for Word files, not TeX files, which automatically determine column widths.

If colwidth has fewer widths than the number of columns, the program will guess the best width for the remaining columns. Specifying colwidth(10) will assign a width of 10 characters to the first column in the table, but not change the width of other columns. To assign a width of 10 to all columns in a five column table, use colwidth(10 10 10 10 10). The width of the column using colwidth(1) is equal to the width of one "n" of the currently assigned point size, with the addition of the default buffers on either side of the cell.

multicol(numtriple[; numtriple ...]) combines table cells into one cell that spans multiple columns. This is mainly used for column titles that apply to more than one column.

A numtriple means three numbers, separated by commas. Each numtriple consist of the row of the first cell to be combined, the column of the first cell, and the number of cells to be combined (>=2).

For example, to combine the heading for the first two statistics columns in a table (with only one rtitles column), the option would be multicol(1,2,2). That is, the combined cells start in the first row of the table (below the title) and the second column of the table (the start of the statistics columns), and two cells are to be combined. See an example of this in outreg Example 10.

It often looks good to underline the ctitles in the combined cell to make clear that the column title applies to both columns below it. In Word RTF files, underlining does not apply to blank spaces, so to extend the underline to either side of the text in the ctitle, you can insert tab characters, which will be underlined. For example, for the ctitle text "First 2", you could apply codes for underlining and tabs like this: ctitle("", "{\ul\tab First 2\tab\tab}"). Note the obligatory space between RTF code ("\tab") and the text. Underscore characters "_" can also be used to extend underlining where there is no text, although they create a line that is slightly lower than the underlining line.

coljust(cjstring[; cjstring ...]) specifies whether the table columns are left, center, or right justified (that is, the text in each row is flush with the left, center, or right side of the column) or centered on the decimal point (for Word files only). By default, the rtitles columns are left justified, and the rest of the columns are decimal justified for Word files. For TeX files, rtitles columns are left justified, and the rest of the columns are center justified.

cjstring is a string made up of:

element action --------------------------------------- l left justification c center justification r right justification . decimal justification (Word only) {} repetition ---------------------------------------

Left, center, and right justification are self-explanatory, but decimal justification requires some elaboration. Decimal justification lines up all of the numbers in the column so that the decimal points are in a verticle line. Whole numbers are justified to the left of the decimal point. Text in the ctitles is not decimal justified - otherwise the whole ctitle for the column would be to the left of the decimal point, like whole numbers. Instead, in columns with decimal justification ctitles are center justified.

Decimal justification works with comma decimal points used in many European languages (to set comma decimal points in Stata, see set dp comma). However, Microsoft Word will recognize the comma decimal points correctly only if the operating system has been changed to specify comma decimal points. In the Windows operating system, this can be done in the Control Panel under Regional and Language Options. In the OSX operating system, this is done in System Preferences under Language and Text: Formats.

Each letter in cjstring indicates the column justification for one column. For example, "lccr" left justifies the first column, center justifies the second and third column, and right justifies the fourth column. If there are more than four columns, the remaining columns will be right justified, since the last element in the string is applied repeatedly. If there are fewer than four columns, the extra justification characters are ignored.

The curly brackets "{}" repeat the middle of cjstring. For example, "l{c}rr" left justifies the first column, center justifies all the subsequent columns up to the next to last column, and right justifies the last two columns.

The semi-colon ";" applies column justification to separate sections of the formatted table, but is not needed by most users. Formatted tables have two column sections: the columns of rtitles (typically one column), and the columns of statistics.

The section divider allows you to specify the column justification without knowing how many columns are in each section. Hence, the default coljust parameters for Word files are coljust(l;.), which applies left justification to all the columns in the first (rtitles) section of the table and decimal justification to the remaining column sections of the table.

For example, coljust(l{c}r;r{c}l) would apply "l{c}r" only to the first column section, and "r{c}l" to the second (or more) column sections.

Technical Note: TeX has the capability for decimal justification using the dcolumn package or the {r@{.}l} column justification syntax. However, both these methods conflict with other capabilities of formatted tables in ways that make them very difficult to implement. The dcolumn package imposes math mode for the decimal justified columns, which is inconsistent with the default formatting, and also interferes with the multicol option. The {r@{.}l} syntax splits the column in question into two columns, which would require workarounds for many options. Users who do not care to have their t statstics displayed in a smaller font than the coefficient estimations (the default), can modify their TeX tables manually to implement decimal justification using the dcolumn package.

nocenter: Don't center the formatted table within the document page. This does not apply to the display of the table in the Stata Results window, which is always centered.

+--------------------+ ----+ Font specification +-----------------------------------------------

basefont(fontlist) changes the base font for all text in the formatted table, as well as pretext and posttext. The default font specification is 12 point Times New Roman for Word documents, and is left unspecified for TeX documents (which normally means it is 10 point Times New Roman).

The fontlist is made up of elements in the tables below (different for Word and TeX files), separated by spaces. The elements of the fontlist can specify font size, font type (e.g. Times Roman, Arial, or a new font from addfont), and font style (like italic or bold).

If you specify more than one font type (roman, arial, courier, and perhaps fnew#), only the last choice in the fontlist will be in effect.

See outreg Example 11 for an application of basefont.

A fontlist for Word files is made up of:

element action ------------------------------------------------------ fs# font size in points arial Arial font roman Times New Roman font courier Courier New font fnew# font specified in addfont plain no special font effects b bold text i italize text scaps small caps: capitalize lower case letters ul underline text uldb underline text with a double line ulw underline words only (not spaces between words) ------------------------------------------------------

A fontlist for TeX files is made up of:

element action ------------------------------------------------------ fs# font size in points (10, 11, or 12)* Huge bigger than huge huge bigger than LARGE LARGE bigger than Large Large bigger than large large bigger than normalsize normalsize default font size small smaller than normalsize footnotesize smaller than small scriptsize smaller than footnotesize tiny smaller than scriptsize rm Times Roman font it italic text bf bold face text em emphasize text (same as bf) sl slanted text sf sans-serif font, i.e. Arial sc small caps tt teletype, i.e. Courier underline underline text ------------------------------------------------------ * fs# can only be specified in the basefont option for TeX files, not in other font specification options.

titlfont(fontcolumn) changes the font for the table's title. notefont(fontcolumn) changes the font for notes below the table.

titlfont and notefont take a fontcolumn rather than a fontlist to allow for different fonts on different rows of titles or notes, such as a smaller font for the subtitle than the main title.

A fontcolumn consists of fontlist [ \ fontlist ... ], where fontlist is defined above for Word files or for TeX files.

For example, to make the title font large and small caps, and the subtitles still larger than regular text, without small caps, you could use titlfont(fs17 scaps \ fs14) for a Word file, or titlfont(Large sc \ large) for a TeX file.

ctitlfont(fontgrid [; fontgrid ...]) changes the fonts for column titles. rtitlfont(fontgrid [; fontgrid ...]) changes the fonts for row titles. statfont(fontgrid [; fontgrid ...]) changes the fonts for statistics in the body of the table.

ctitlfont's, rtitlfont's, and statfont's arguments are fontgrids to allow a different font specification for each cell of the ctitles, rtitles, or the table statistics, respectively. By default, all of these areas of the table have the same font as the basefont, which by default is Times Roman, 12 point for Word files.

A fontgrid consists of fontrow [ \ fontrow ... ], where fontrow is fontlist [ , fontlist ...] and where fontlist is defined above for Word files and for TeX files.

For example, to make the font for the first row of ctitles bold and the second (and subsequent) rows of ctitles italic, you could use ctitlfont(b \ i) for a Word file, or ctitlfont(bf \ it) for a TeX file.

The semi-colon ";" in the argument list applies different fonts to separate sections of the formatted table. This is more likely to be useful for row sections than column sections. Formatted tables have two column sections: the columns of rtitles (typically one column), and the columns of statistics. outreg tables, for example, have four row sections: the rows of ctitles (often one row), and three sections for the rtitles and statistics: the rows of regular coefficients, the rows of constant coefficients, and the rows of summary statistics below the coefficients.

The section divider allows you to specify the column or row fonts without knowing for a particular table how many columns or rows are in each section. To italicize the t statistics below coefficient estimates for the coefficients, but not italicize the summary statistics rows, you could use statfont(plain \ i; plain \ i; plain) for a Word file, or statfont(rm \ it; rm \ it; rm) for a TeX file.

Note that if you specify a new font type or a single font point size in titlfont or statfont, this is applied to all rows of the title or estimation statistics, removing the default behavior of making the subtitles smaller than the first row of title, and the "substatistics" like the t statistic smaller than the coefficient estimates. To retain this behavior, specify two rows of font sizes in titlfont or statfont, with the second being smaller than the first. Changing the basefont does not have any effect on the differing font sizes in the rows of title and estimation statistics.

addfont(textrow) adds a new font type, making it available for use in the font specifications for various parts of the formatted table. This option is available only for Word files, not TeX files.

By default, only Times Roman ("roman"), Arial ("arial"), and Courier New ("courier") are available for use in Word RTF documents. addfont makes it possible to make additional fonts available for use in the Word documents created.

textrow is a sequence of font names in quotation marks, separated by commas.

The new font in addfont can be referenced in the various font specification options, like basefont and titlfont with the code "fnew1" for the first new font in addfont and increments of it ("fnew2", "fnew3", etc.) for each additional font.

If the font specified in addfont is not available on your computer when using the Word file created, the new font will not display correctly - another font will be substituted. You can find the correct name of each available font in Word by scrolling through the font selection window on the toolbar of the Word application. Correct capitalization of the font name is necessary.

See outreg Example 11 for an application of addfont.

plain eliminates default formatting, reverting to plain text: only one font size for the whole table, no column justification, and no added space above and below the horizontal border lines. Instead of using plain, the default formatting can also be reversed feature by feature with titlfont, notefont, coljust, spacebef, and spaceaft. The plain option does this all at once.

table sections: It can be helpful for specifying fonts and other formatting to understand how outreg divides the table into sections. The following diagram illustrates the section divisions:

+--------------------------------------------------------+ | title | +--------------------------------------------------------+ column section 1 column section 2 +--------------------------------------------------------+ +- +--------------------------------------------------------+ | | | | row section 1 | | ctitles | ctitles | | | | | |- |------------------+-------------------------------------| | | | | | | | | | | | | row section 2 | | rtitles | coefficient estimates | | | | (except for constants) | | | | | | | | | |- |------------------+-------------------------------------| row section 3 | | rtitles | constant coefficients | |- |------------------+-------------------------------------| row section 4 | | summtitles | summstats | +- +--------------------------------------------------------+

+--------------------------------------------------------+ | note | +--------------------------------------------------------+

+--------------------------+ ----+ Border lines and spacing +-----------------------------------------

hlines(linestring [; linestring ...]) draws horizontal lines between rows. vlines(linestring [; linestring ...]) draws verticle lines between columns.

hlines and vlines designate where horizontal and verticle lines will be placed to delineate parts of the table. By default the formatted table has horizontal lines above and below the ctitle header rows and at the bottom of the table above the notes, if any. There are no verticle lines by default.

linestring is a string made up of:

element action --------------------------------------- 1 add a line 0 no line {} repetition ---------------------------------------

Each "1" in linestring indicates a line and a 0 indicates no line. For example, hlines(110001) would draw a line above and below the first row of the table and below the fifth row (above the sixth row). There is one more possible horizontal line than row (and one more verticle line than column). That is, for a five row table, to put a line above and below every row one would specify six hlines: hlines(111111).

hlines and vlines are not displayed correctly in the Stata Results window. They only apply to the final Word or TeX document.

Curly brackets "{}" repeat the middle of linestring. For example, hlines(11{0}1) puts a horizontal line above and below the first row, and another below the last row.

The semi-colon ";" applies line designations to separate sections of the formatted table. outreg tables, for example, have two column sections and four row sections. The column sections are made up of the columns of rtitles (typically one column), and the columns of the estimation statistics. The row sections are made up of the rows of ctitles (often one row), the rows of the coefficient estimates (except the constant), the rows of the constant coefficients, and the rows of the summary statistics below the coefficients.

The section divider allows you to specify the hlines and vlines without knowing how many rows and columns are in each section. Hence, the default hlines elements are hlines(1{0};1{0}1), which puts a horizontal line above the header rows, a line above the statistics rows, and a line below the last statistics row. By default, there are no vlines, which some graphic designers think are best avoided.

hlstyle(lstylestring [; lstylestring ...]) changes the style of horizontal lines. vlstyle(lstylestring [; lstylestring ...]) changes the style of verticle lines.

hlstyle and vlstyle options are only available for Word files. By default, all lines are solid single lines.

lstylestring is a string made up of:

element action -------------------------------------------- s Single line d Double line o Dotted line a Dashed line S Heavy weight single line D Heavy weight double line O Heavy weight dotted line A Heavy weight dashed line {} repetition --------------------------------------------

Repetition using curly brackets "{}" and semi-colons ";" for section dividers are used in the same way they are for hlines and vlines.

Some word processing applications, like OpenOffice or Pages (for the Mac) do not display all Word RTF line styles correctly.

spacebef(spacestring [; spacestring ...]) puts space above cell contents. spaceaft(spacestring [; spacestring ...]) puts space below cell contents. spaceht(#) changes the size of the space above & below cell contents in spacebef and spaceaft.

spacebef and spaceaft are options to make picky changes in the appearance of the table. They increase the height of the cells in particular rows so that there is more space above and below the contents of the cell. They are used by default to put space between the horizontal line at the top of the table and the first header row, above and below the line separating the header row from the statistics, and put space below the last row of the table, above the horizontal line.

spacestring has the same form as linestring above. A "1" indicates a extra space (above the cell if in spacebef and below the cell if in spaceaft), and a "0" indicates no extra space. "{}" repeats indicators and ";" separates row sections.

spaceht controls how big the extra space is in spacebef and spaceaft. Each one unit increase in spaceht increases the space by about a third of the height of a capital letter. The default is spaceht(1). spaceht is scaled proportionally to the base font size for the table. For example spaceht(2) makes the extra spacing 100% larger than it is by default.

For TeX files (using the tex option), spaceht can only take the values 2 or 3. The default corresponds to the LaTeX code \smallskip.

Values 2 and 3 for spaceht correspond to the LaTeX codes \medskip and \bigskip, respectively.

+-----------------+ ----+ Page formatting +--------------------------------------------------

landscape puts the document page containing the formatted table in landscape orientation. This makes the page wider than it is tall, in contrast to portrait orientation. landscape is convenient for wide tables. An alternative way of fitting a table on the page is to use a smaller basefont, without the need for the landscape option.

a4 specifies A4 size paper (instead of the default 8 1/2” x 11”) for the Word or TeX document containing the formatted table.

+--------------------------+ ----+ File and display options +-----------------------------------------

tex writes a TeX output file rather than a Word file (as long as using filename is specified). The output is suitable for including in a TeX document (see the fragment option) or loading into a TeX typesetting program such as Scientific Word.

merge[(tblname]) specifies that new statistics be merged to the most recently created formatted table. The new statistics are combined with previous estimates, lined up according to the appropriate variable name (or rtitles), with the statistics corresponding to new row titles placed below the original statistics. In the case of outreg, coefficient estimates of new variables are placed below the estimates for existing coefficients, but above the constant term.

Note that previous versions of the outreg command, the merge option was called append. Users will usually want to specify ctitles when using merge.

merge can be used even if a previous formatted table does not exist for merging. This is to enable merge to be used in loops, as in outreg Example 16. Users will see a warning message if no existing table is found.

If a tblname is specified, the current estimates will be merged to an existing table named tblname, which could have been created with a previous command using the store(tblname), merge(tblname) or append(tblname) options.

A tblname consists of the characters A-Z, a-z, 0-9, and "_", and can have a length of up to 25 characters.

replace specifies that it is okay to overwrite an existing file.

addtable places the estimation results as a new table below an existing table in the same document (rather than combining the tables as with merge). This makes it possible to build up a document with multiple tables in it.

Options pretext and posttext can add accompanying text between the tables. To put a page break between successive tables, so that each table is on its own page, see the discussion for pretext and posttext.

See outreg Example 13 for an application of addtable.

append[(tblname)] combines the statistics as new rows below an existing table. If a tblname is specified, the statistics will be appended to an existing formatted table named tblname (see the store option).

Warning: this is not the append option from previous versions of outreg - use merge.

append can be used even if no previous formatted table exists, which is useful in loops for the first invocation of the append option.

append does not match up column headings. The column headings of the new table being appended are ignored unless the new table has more columns than the original table, in which case only the headings of the new columns are used.

replay[(tblname)] is used to rewrite an existing formatted table to a file without including any new statistics (unless paired with merge or append). This can be used to rewrite the same table with different text formatting options. It is also useful for use after building a table in a loop to write the final table to a file. If a tblname is specified, replay will use the table with that name.

replay is useful after running a loop that merges multiple estimation results together, to write the final merged table to a document file. See outreg Example 16.

replay changes the behavior of merge and append when they have table names, causing them to merge or append results from the table specified into the table specified by replay.

store(tblname) is used to assign a tblname to a formatted table. This is useful mainly for building more than one table simultaneously, by merging new estimation results to separate tables when the estimation commands must be run sequentially.

clear[(tblname)] removes the current formatted table from memory. This is helpful when using merge option in a loop so that the first time it is invoked, the estimation results is not merged to an existing formatted table (such as the one created the last time the .do file was run). outreg, clear clears the current table, allowing the user to start with a blank slate.

If a tblname is specified, the formatted table named tblname will be removed from memory. When using multiple tblnames, they must be cleared one by one. An alternative is to use mata: mata clear to clear all of Mata's memory space, including the formatted tables.

fragment creates a TeX code fragment for inclusion in a larger TeX document instead of a stand-along TeX document. A TeX fragment saved to the file auto.tex can then be included in the following TeX document with the TeX \input{auto} command:

\documentclass[]{article} \begin{document} ... text before inclusion of table auto.tex ... \input{auto} ... text after inclusion of table auto.tex ... \end{document}

Including TeX fragments with the TeX \input{} command allows the formatted table to be updated without having to change the TeX code for the document itself. This is convenient because estimation tables often require small modifications which can be made without having to reinsert a new table manually. Creating TeX fragments for inclusion in larger TeX documents is especially useful when there are many tables in a single document (see also the addtable option).

An alternative to the TeX \input{} command is the TeX \include{} command which inserts page breaks before and after the included table.

nodisplay suppresses displaying the table in the Stata Results window.

dwide displays all columns in the Stata Results window, however wide the table is. This is mainly useful if you want to copy the table to paste it into another document (which hopefully is not necessary). Without the dwide option, very wide tables are displayed in the Results window in sections containing as many columns as will fit given the current width of the Results window.

+------------------+ ----+ Brackets options +-------------------------------------------------

squarebrack substitutes square brackets for parentheses around the statistics placed below the first statistic. For the default statistics, this means that square brackets, rather than parentheses, are placed around t statistics below the coefficient estimates.

squarebrack is equivalent to brackets("","" \ [,] \ (,) \ <,> \ |,|).

brackets(textpair [\ textpair ...]) specifies the symbols used to bracket statistics. By default, the first statistic has no brackets and parentheses are placed around the second statistic, such as the t statistic below the estimated coefficient estimate when using outreg.

A textpair is made up of two elements of text separated by a comma. The default brackets are brackets("","" \ (,) \ [,] \ <,> \ |,|).

If there are a sufficient number of statistics for the symbols <,> and |,| to be used with the tex option, they are replaced by $<$,$>$ and $|$,$|$ so that they show up correctly in TeX documents.

brackets has no effect when the nosubstats option is in effect.

nobrket eliminates the application of brackets, so that there would be no brackets around the second or higher statistics.

dbldiv(text) is a rather obscure option that allows you to change the symbol that divides double statistics. Double statistics have both a lower and and upper statistic, like confidence intervals. The default is a dash "-" between the lower and upper statistics, but dbldiv allows you to substitute something else. For example, dbldiv(:) would put a colon between the lower and upper statistics.

Inline text formatting: superscripts, italics, Greek characters, etc.

The font specification options allow users to control font characteristics at the table cell level, but users often want change the formatting of a word or just a character in text or a table cell. This is true for characteristics like superscripts, subscripts, italics, bold text, and special characters such as Greek letters.

Text strings in the formatted table can include inline formatting codes that change the characteristics of just part of a string. These codes are distinct between Word and TeX files, since they are really just Word and TeX formatting codes that are passed directly to the output files.

See outreg Example 12 for an application of inline formatting codes in a Word table.

Word inline formatting

The Word files are written in the Word Rich Text Format (RTF) specification. Most of the RTF specification codes can be included in the formatted text (find the full 210 page specification in the links of en.wikipedia.org/wiki/Rich_Text_Format). This note will explain a subset of the most useful codes.

Word RTF codes at enclosed in curly braces "{" and "}". Codes start with a backslash character "\" and then the code word. There must be a space after the code word before the text begins so that the text is distinguished from the code. For example, the formatting to italicize the letter "F" is "{\i F}", because "i" is the RTF code for italics.

Be very careful to match opening and closing curly brackets because the consistency of the nested curly brackets in a Word file is essential to the file's integrity. If one of the curly brackets is missing, the Word file may be corrupted and unreadable. You can trace problems of this kind by temporarily removing inline formatting that includes curly braces.

RTF code action ----------------------------------------------------------- \i italic \b bold \ul underline \scaps small capitals \sub subscript (and shrink point size) \super superscript (and shrink point size) \fs# font size (in points * 2; e.g. 12 point is \fs24) -----------------------------------------------------------

Most of these codes are the same as those used in the font formatting options, but there are some differences, such as the font size code \fs# using half points, not points.

Greek and other Unicode characters in Word

Word RTF files can display Greek letters and any other Unicode character (as long as it can be represented by the font type you are using). The codes are explained here. Unicode codes in Word are an exception to the rule that the code must be followed by a space before text. Text can follow immediately after the Unicode code.

TeX inline formatting

The discussion of TeX inline formatting is brief because TeX users are usually familiar with inserting their own formatting codes into text. Many online references explain how to use TeX formatting codes. A good place to start is the references section of en.wikipedia.org/wiki/TeX.

For many formatting effects, TeX can generate inline formatting in two alternative ways: in math mode, which surrounds the formatted text or equation with dollar signs ("$"), or in text mode which uses a backslash followed by formating code and text in curly brackets.

For example, we can create a superscipted number 2 either as "$^2$" in math mode or "\textsuperscript{2}" in text mode. To display R-squared in a TeX document with the "R" italicized and a superscript "2", one can either use the code "$ R^2$" or the code "\it{R}\textsuperscript{2}".

Note the space between the "$" and "R" in "$ R^2$", which is a Stata, not a TeX, issue. If we had instead written "$R^2$", Stata would have interpreted the $R as a global macro, which is probably undefined and empty, so the TeX document would just contain "^2$". Whenever using TeX inline formatting in math mode which starts with a letter, make sure to place a space between the "$" and the first letter.

Math mode generally italicizes text and is designed for writing formulas. A detailed discussion of its capabilities is beyond the scope of this note. Below is a table of useful text mode formatting codes.

TeX code action ------------------------------------------------------ \it italic \bf bold \underline underline \sc small capitals \textsubscript subscript (and shrink point size) \textsuperscript superscript (and shrink point size) ------------------------------------------------------

Keep in mind that many of the non-alphanumeric characters have special meaning in TeX, namely _, %, #, $, &, ^, {, }, ~, and \. If you want these characters to be printed in TeX like any other character, include a \ in front of the character. The exceptions are the last two, ~ and \ itself. ~ is represented by \textasciitilde, and \ is represented by either \textbackslash or $\backslash$ to render properly in TeX.

Greek letters in TeX

Greek letters can be coded in TeX documents with a backslash and the name of the letter written in English, surrounded by "$". For example, a lowercase delta can be inserted with the code "$\delta$". Upper case Greek letters use the name in English with an initial capital, so an uppercase delta is "$\Delta$". If you can't remember how to spell Greek letters in English, look at the table for Greek letter codes in Word here.