Aarhus University
Support: mark.soe558@gmail.com
help for niceest Authors: Mark Soe and Henrik Stovring

Title

niceest - Export regression table to excel or word

Syntax

niceest , outfile(filename[, replace])[ word] [ excel] [ options]

Required
outfile(filename[, replace]) Save a formatted regression table to an Excel file (default) or Word.

Fileformat
word Exports regression results into a word file.

excel Exports regression results into a excel file.

Model
pvalues(string) P-values are displayed with label defined as string

se(string) Standard errors are displayed with label defined as string

df(string) Degrees of freedom is displayed with label defined as string

intercept(string) Label intercept defined as string; default is Intercept

Reporting
format(%fmt) Display format for variables; default is %6.2f

pformat(%fmt) Display format for P-values; default is format

eform Exponentiate estimates and confidence limits

cidelims(string) Set appearance for confidence interval; default is [;]

level(#) Confidence level for calculating confidence limits; default is level(95)

addspace Adds space between the explanatory variables

raw Displays the table in its raw format, without changes to the layout

The options word and excel are mutually exclusive
as only one output file is allowed.
excel is the default if neither is specified.

Note that it is not allowed to combine word and addspace.

Description

niceest relies on parmest to export regression results into a formatted table in either Excel or Word. As input niceest takes the most recently executed regression analysis and as ouput creates a table in excel or word with labeled regression coefficients, estimates and confidence intervals. If requested by the user, p-values, standard errors and degrees of freedom will be included in the table.

Excel 2007/2010(.xlsx) files are supported.

Microsoft Word Open XML(.docx) files are supported.

*Note*

parmest has to be installed before running niceest. parmest can be installed from: parmest

Options

+
+

-----+ Required +

outfile(filename[, replace]) is required. If there is no file named filename with the same fileformat as defined, it creates a new file named filename. If a file named filename with the same fileformat already exists, an error will be displayed unless the replace option is used.

replace overwrites an existing file. If the file does not exist, a new file will be created irrespective of replace being specified or not.

+
+

-----+ Fileformat +

word defines .docx to be used as the outfile-format. The regression results will be exported to a table in an word-file named filename.docx. If neither word nor excel is defined, excel is assumed

excel defines .xlsx to be used as the outfile-format. The regression results will be exported to a table in an excel-file named filename.xlsx. If neither word nor excel is defined, excel is assumed

+-------+

-----+ Model +

pvalues(string) includes p-values for each variable and the intercept in the excel file. string is used as the column header.

se(string) includes standard error for each variable and the intercept in the excel file. Displays string as the column header.

df(string) includes degrees of freedom for each variable and the intercept in the excel file. Displays string as the column header.

intercept(string) labels the intercept as string. If omitted the intercept will be labeled "Intercept".

+
+

-----+ Reporting +

format(%fmt) specifies how numbers from regression output are to be displayed in the excel file. Only numerical formats are allowed; see: [D] format

pformat(%fmt) specifies how p-values from regression output are to be displayed in the Excel file. If both pformat and format are specified, the p-values will be formatted as specified by pformat. If pformat is not specified, the p-values will be formatted as specified by format.

eform exponentiates coefficients and associated intervals in the output.

cidelims(string) sets the appearance of delimiters of confidence intervals as string. The available sets of delimiters are (:), [:], (-), [-], (;) or [;].

level(#) sets the confidence level at #. If level is not specified, the default confidence level of 95% is used.

addspace adds an empty row between the explanatory variables in the excel file.

Remarks

The regression tables produced by Stata are typically not in a format desired by users for inclusion in reports and manuscripts ready for submission. Several user-written packages are available for more polished presentation of estimates and associated statistics. niceest is an extension of parmest as it export results to a formatted Excel-file in which variable and value labels (if present) are used. Further the package allows for flexible specification of confidence intervals, inclusion of p-values, degrees-of-freedom and standard errors. The code was first developed for an introductory regression course for students in public health, and is aimed at providing a minimal and yet nicely formatted table, which can be directly included in Word-documents (or similar word processors).

Examples

Start by opening a dataset
. sysuse auto

Example 1 - How to use niceest with no options

First run the regression that you wish to export
. regress price b0.foreign weight

Next run the niceest command
. niceest, outfile(table1)

In this example the regression will be exported to an excel-file named table1.xlsx. The replace option can be added, if an excel-file with the same name exists, and you wish to replace it.

Example 2 - How to use the model-otions

If you wish to add to/change what will be displayed in the excel-file, you can add one or more of the
model-options
. niceest, outfile(table1, replace) pvalues(p) intercept(Reference)

In this example the outputtable will display the pvalues as p and change the name of the intercept to
Reference. If you wish to also add degrees of freedom to the table, add it as an option
. niceest, outfile(table1, replace) pvalues(p) intercept(Reference) df(dof)

Example 3 - How to use the reporting-otions

If you wish to change how the numbers in the table are to be displayed in the excel-file, you can add one or more of the repoting-options. A few examples are shown below:

. niceest, outfile(table1, replace) cidelims([:])
. niceest, outfile(table1, replace) cidelims([:]) format(%7.3f)
. niceest, outfile(table1, replace) format(%7.3f) se(Standard Error)

Example 4 - How to export to word

If you wish to export the regression table to word, add the word-option when running the niceest command. Examples are shown below:

. niceest, outfile(table1) word
. niceest, outfile(table1, replace) cidelims([:]) format(%7.3f) word
. niceest, outfile(table1, replace) pvalues(p) intercept(Reference) word

Also see

Parmest helpfile - help parmest