Skip to content

Program to produce publication ready regression tables in MS Word from stored estimates

Notifications You must be signed in to change notification settings

glennsandstrom/estdocx

Repository files navigation

estdocx v. 0.97

Program to produce publication ready regression tables in MS Word from stored estimates in the same fashion as the command:

estimates table

in Stata.

Already in version 15 of Stata the command putdocx provided a native implementation for exporting estimates trough the command docx table results = etable.

However, using etable directly after estimates store causes unwanted formatting issues in the resulting table. E.g. hidden characters in cells making formating of the table in MSWord difficult. This implementation avoid such issues and allows some additional benefits by providing options for the formating of the resulting table, automatic inclusion of legend etc.

Since Stata version 17 the same kind of results can be achived with the collect suite of commands but estdocx provides a much simpler boxed alternative without the rather complicated syntax and logic that comes with using collect.

See help file for examples of how to use the program.

Example of output in MS Word format

This is the result of running the example found in the helpfile exampletable

Installation

Either use net command in Stata:

net install estdocx , from(https://github.com/glennsandstrom/estdocx/raw/master/)

Or use the excellent github command by E. F. Haghish by first running

net install github, from("https://haghish.github.io/github/")

...and then installing estdocx by running

github install glennsandstrom/estdocx

Updating

Use the same command as above but add the option replace

net install estdocx , from(https://github.com/glennsandstrom/estdocx/raw/master/) replace

If you have used the github command by haghish rather run

github update estdocx

Usage

Title

estdocx

A command giving same functionality as estimates table but exports results directly to a Word table

Syntax

estdocx namelist [, options]

Options Description
saving(filename) Path/filename of the generated docx file.
inline Add table to a docx in memory rather than saving to standalone file.
title(string) Optional title for table.
colabels(string) Optional labels for columns. Supply list of column number # "label"... Default is to label models/columns using the names of the stored estimates used to form the table.
bfmt(%fmt) Stata format used for coefficients. Default is %9.2f
star(numlist) Numlist of significance levels. If option is omitted significance is reported numerically.
nopval Do not report significance levels.
ci(%fmt) Stata format used for 95% confidence intervals. If option is omitted no CIs are not reported.
stats(scalarlist) Report scalarlist in table. Allowed is N aic bic
baselevels Include all baselevels.
keep(coflist) List of coefficient to include in table.
pagesize(psize) Set pagesize of Word document.
landscape Use landscape layout for word document.
eform Report parameters as exp(B).

Description

estdocx takes a namelist of stored estimates and exports this to a publication quality table in MS Word. Although it is possible to export estimates to a table using the command putdocx avaliable since Stata v.15 i.e. putdocx table results =etable and since Stata v.17 through the collect suite of commands both of these options has some drawbacks. The simple built-in method of putdocx causes unwanted formatting issues in the resulting table such as e.g. hidden characters in cells making it difficult to choose alignment in the cells and the need to erase these characters. estdocx avoid such issues and allows some additional benefits by providing options for the formatting of the resulting table and inclusion of legend etc.

The command etable and collect avaliable in Stata v17 is a very powerful command, but is quite complex and making the desired table requires quite a lot of coding. If the desired table is a multicolumn regression table estdocx is a much simpler way to produce the desired table with just one command.

Examples

Setup

sysuse nlsw88, clear

Run estimation command

logistic never_married c.age i.race i.collgrad c.wage

Store model using estimates

estimates store _1_

Run second model

logistic never_married c.age i.race i.collgrad c.wage c.grade

Store second model using estimates

estimates store _2_

Run third model

logistic never_married c.age i.race b1.collgrad c.wage c.grade c.tenure collgrad#race b1.collgrad#c.tenure

Store second model using estimates

estimates store _3_

Run command to produce table in Word document estimates_table.docx

estdocx _1_ _2_ _3_ , star(.05 .01 .001) b(%9.2f) title("Table 1: Test title") baselevels

Author

Dr Glenn Sandström, Umeå Univerity, Sweden. Email: glenn.sandstrom@umu.se Web:http://www.umu.se/en/staff/glenn-sandstrom/

About

Program to produce publication ready regression tables in MS Word from stored estimates

Resources

Stars

Watchers

Forks

Packages

No packages published