{smcl} {* *! version 2.4.6}{...} {viewerjumpto "Syntax" "ntables##syntax"}{...} {viewerjumpto "Description" "ntables##description"}{...} {viewerjumpto "Options" "ntables##options"}{...} {viewerjumpto "Examples" "ntables##examples"}{...} {title:Title} {phang} {bf:ntables} {hline 2} Advanced journal-level publication-ready tables from Noterva {marker syntax}{...} {title:Syntax} {p 8 17 2} {cmdab:ntables} [{cmd:using} {it:filename}] [{cmd:,} {it:options}] {cmd::} [{it:stata_cmd}] {p 8 17 2} Alternatively (Post-estimation syntax): {cmdab:ntables} [{it:anything}] [{cmd:using} {it:filename}] [{cmd:,} {it:options}] {synoptset 20 tabbed}{...} {synopthdr} {synoptline} {syntab:Main} {synopt:{opt f:ormat(string)}}specify the output format (DOCX, XLSX, HTML, CSV). Default is DOCX.{p_end} {synopt:{opt append}}append to existing file{p_end} {synopt:{opt replace}}replace existing file{p_end} {synopt:{opt title(string)}}title for the exported table{p_end} {synopt:{opt nohead:er}}suppress title for appended tables{p_end} {synopt:{opt dec(integer)}}decimal places for output (default: 3){p_end} {synopt:{opt pvals}}report exact p-values in parentheses (especially for correlation tables){p_end} {synopt:{opt mod:els(string)}}a list of stored estimates (e.g., m1 m2 m3) to output side-by-side{p_end} {synopt:{opt keep(string)}}list of variables to keep in the table{p_end} {synopt:{opt drop(string)}}list of variables to drop from the table{p_end} {synopt:{opt label}}use variable labels instead of raw variable names{p_end} {synopt:{opt star(string)}}custom significance breakpoints (default: 0.10 0.05 0.01){p_end} {synopt:{opt addn:ote(string)}}custom note to append at the bottom of the table{p_end} {synopt:{opt stats(string)}}summary statistics to dynamically append (e.g., N r2 r2_a rmse F p){p_end} {synopt:{opt test(string)}}override test type auto-detection (reg, sum, corr, tab, desc, unitroot, rf){p_end} {synoptline} {p2colreset}{...} {marker description}{...} {title:Description} {pstd} {cmd: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. {pstd} As of version 2.4.2, {cmd:ntables} supports a **Prefix Command** syntax. This allows you to place {cmd:ntables using filename :} immediately before your standard Stata commands, executing the command and exporting the publication-ready table in a single step. {pstd} It supports advanced variable filtering, custom significance stars, multi-model **side-by-side** appending natively, survey weights ({cmd:svy:}), and multiple formats (DOCX, XLSX, HTML, CSV). {marker options}{...} {title:Options} {phang} {opt test(string)} Overrides the auto-detection feature. Options are: {break} {bf:reg} (Regressions, Logit, Probit, and any e(b)/e(V) estimator) {break} {bf:sum} (Summary Statistics) {break} {bf:corr} (Correlation Matrices) {break} {bf:tab} (One-way and Two-way Cross-Tabulations) {break} {bf:desc} (Data Dictionaries / Codebooks) {break} {bf:rf} (Random Forest Variable Importance) {break} {bf:unitroot} (Unit Root Tests) {phang} {opt nohead:er} Suppresses the table title (e.g., "Table 1: Estimation Results"). Use this when using {cmd:append} sequentially so that multiple titles do not stack in the document. This option was named {cmd:notitle} before version 2.4.4; the old name is still accepted but issues a deprecation note. {phang} {opt models(string)} Pass a list of stored estimates generated by {cmd:estimates store} (e.g., {cmd:models(m1 m2 m3)}). {cmd:ntables} will combine them into a single side-by-side regression table. (Note: {cmd:models()} is currently only supported for DOCX formats). {phang} {opt keep(varlist)} and {opt 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. {phang} {opt label} Uses the human-readable Stata variable label instead of the raw variable name. Changes "_cons" to "Constant". {phang} {opt star(numlist)} Custom significance breakpoints for stars. The default is {cmd:0.10 0.05 0.01}. To change to medical standards, use {cmd:star(0.05 0.01 0.001)}. {phang} {opt addnote(string)} Custom text appended to the note below the table. Example: {cmd:addnote("Robust standard errors in parentheses")}. {phang} {opt stats(string)} A space-separated list of stored scalars to print dynamically below the regression variables. Examples: {cmd:N r2 r2_a rmse F p}. {marker examples}{...} {title:Examples} {phang}{cmd:. sysuse auto, clear}{p_end} {phang}{title:1. The Prefix Command (One-Step Export)}{p_end} {phang}{cmd:. ntables using results.docx, replace : regress price mpg weight}{p_end} {phang}{cmd:. ntables using results.docx, append : logit foreign mpg weight}{p_end} {phang}{cmd:. ntables using results.docx, append title("Survey Weighted") : svy: regress price mpg}{p_end} {phang}{title:2. Cross-Tabulations and Codebooks}{p_end} {phang}{cmd:. ntables using results.docx, append : tabulate rep78 foreign}{p_end} {phang}{cmd:. ntables using results.docx, append : describe price mpg rep78}{p_end} {phang}{title:3. Side-by-Side Multi-Model Regression}{p_end} {phang}{cmd:. quietly regress price mpg}{p_end} {phang}{cmd:. estimates store m1}{p_end} {phang}{cmd:. quietly regress price mpg rep78}{p_end} {phang}{cmd:. estimates store m2}{p_end} {phang}{cmd:. ntables using results.docx, append models(m1 m2) title("Side-by-Side Model")}{p_end} {phang}{title:4. Correlation Matrix (with Custom Stars and P-values)}{p_end} {phang}{cmd:. correlate price mpg rep78 weight}{p_end} {phang}{cmd:. ntables using results.docx, append pvals star(0.05 0.01 0.001)}{p_end} {title:Author} {pstd} Ajay Kumar Samariya{break} Noterva, India{break} Website: {browse "https://noterva.com":noterva.com}{break} Extensions: {browse "https://noterva.com/get/":noterva.com/get}{break} Email: notervaindia@gmail.com {p_end}