*! version 2.4.6

Title

ntables -- Advanced journal-level publication-ready tables from Noterva

Syntax

ntables
[using filename]
[, options] : [stata_cmd]

Alternatively (Post-estimation syntax):
ntables
[anything]
[using filename]
[, options]

Main
format(string) specify the output format (DOCX, XLSX, HTML, CSV). Default is DOCX.

append append to existing file

replace replace existing file

title(string) title for the exported table

noheader suppress title for appended tables

dec(integer) decimal places for output (default: 3)

pvals report exact p-values in parentheses (especially for correlation tables)

models(string) a list of stored estimates (e.g., m1 m2 m3) to output side-by-side

keep(string) list of variables to keep in the table

drop(string) list of variables to drop from the table

label use variable labels instead of raw variable names

star(string) custom significance breakpoints (default: 0.10 0.05 0.01)

addnote(string) custom note to append at the bottom of the table

stats(string) summary statistics to dynamically append (e.g., N r2 r2_a rmse F p)

test(string) override test type auto-detection (reg, sum, corr, tab, desc, unitroot, rf)

Description

ntables is an advanced utility that formats output from various statistical software packages into journal-level, publication-ready tables. It is designed to automatically detect the type of test being run (Summary Statistics, Correlation Matrices, Cross-Tabulations, Codebooks, Unit Root tests, and formats output from any e(b)/e(V) estimator) and apply the correct journal-formatting.

As of version 2.4.2, ntables supports a **Prefix Command** syntax. This allows you to place ntables using filename : immediately before your standard Stata commands, executing the command and exporting the publication-ready table in a single step.

It supports advanced variable filtering, custom significance stars, multi-model **side-by-side** appending natively, survey weights (svy:), and multiple formats (DOCX, XLSX, HTML, CSV).

Options

test(string) Overrides the auto-detection feature. Options are:

reg (Regressions, Logit, Probit, and any e(b)/e(V) estimator)

sum (Summary Statistics)

corr (Correlation Matrices)

tab (One-way and Two-way Cross-Tabulations)

desc (Data Dictionaries / Codebooks)

rf (Random Forest Variable Importance)

unitroot (Unit Root Tests)

noheader Suppresses the table title (e.g., "Table 1: Estimation Results"). Use this when using append sequentially so that multiple titles do not stack in the document. This option was named notitle before version 2.4.4; the old name is still accepted but issues a deprecation note.

models(string) Pass a list of stored estimates generated by estimates store (e.g., models(m1 m2 m3)). ntables will combine them into a single side-by-side regression table. (Note: models() is currently only supported for DOCX formats).

keep(varlist) and drop(varlist) Filters variables to be shown or dropped from the exported table. Excellent for removing lengthy lists of control variables or dummy fixed-effects.

label Uses the human-readable Stata variable label instead of the raw variable name. Changes "_cons" to "Constant".

star(numlist) Custom significance breakpoints for stars. The default is 0.10 0.05 0.01. To change to medical standards, use star(0.05 0.01 0.001).

addnote(string) Custom text appended to the note below the table. Example: addnote("Robust standard errors in parentheses").

stats(string) A space-separated list of stored scalars to print dynamically below the regression variables. Examples: N r2 r2_a rmse F p.

Examples

. sysuse auto, clear

1. The Prefix Command (One-Step Export)

. ntables using results.docx, replace : regress price mpg weight

. ntables using results.docx, append : logit foreign mpg weight

. ntables using results.docx, append title("Survey Weighted") : svy: regress price mpg

2. Cross-Tabulations and Codebooks

. ntables using results.docx, append : tabulate rep78 foreign

. ntables using results.docx, append : describe price mpg rep78

3. Side-by-Side Multi-Model Regression

. quietly regress price mpg

. estimates store m1

. quietly regress price mpg rep78

. estimates store m2

. ntables using results.docx, append models(m1 m2) title("Side-by-Side Model")

4. Correlation Matrix (with Custom Stars and P-values)

. correlate price mpg rep78 weight

. ntables using results.docx, append pvals star(0.05 0.01 0.001)

Author

Ajay Kumar Samariya

Noterva, India

Website: noterva.com

Extensions: noterva.com/get

Email: notervaindia@gmail.com