Giter VIP home page Giter VIP logo

estout's Introduction

estout

The estout package provides tools for making regression tables in Stata. The package currently contains the following programs:

  1. esttab: Command to produce publication-style regression tables that display nicely in Stata's results window or, optionally, are exported to various formats such as CSV, RTF, HTML, or LaTeX. esttab is a user-friendly wrapper for the estout command.

  2. estout: Generic program to compile a table of coefficients, "significance stars", summary statistics, standard errors, t- or z-statistics, p-values, confidence intervals, or other statistics for one or more models previously fitted and stored. The table is displayed in the results window or written to a text file for use with, e.g., spreadsheets or LaTeX.

  3. eststo: Utility to store estimation results for later tabulation. eststo is an alternative to official Stata's estimates store. Main advantages of eststo over estimates store are that the user does not have to provide a name for the stored estimation set and that eststo may be used as a prefix command.

  4. estadd: Program to add extra results to the returns of an estimation command. This is useful to make the the results available for tabulation.

  5. estpost: Program to prepare results from commands such as summarize, tabulate, or correlate for tabulation by esttab or estout.

To install the estout package from the SSC Archive, type

. ssc install estout, replace

in Stata. Stata version 8.2 or newer is required.


Installation from GitHub:

. net install estout, replace from(https://raw.githubusercontent.com/benjann/estout/master/)

Main changes:

09apr2023
estout.ado (3.32); ettab.ado (2.1.2)
- Windows network paths starting with a double backslash (\\) did not work; this
  is fixed

10feb2023
estpost.ado (1.2.2)
- option elabels() in -estpost correlate- now stores additional info in
  e(labels) and e(eqlabels) (if option -matrix- has specified); option -nolabel-
  changes behavior of -elabels()-

10jun2022
esttab.ado (2.1.1)
- option -standalone- added

26apr2022
estout.ado (3.31)
- when writing RTF format, the horizontal rule between table header and table
  body was missing if the table body contained only a single physical row; this
  is fixed 

25mar2022
estout.ado (3.30)
- estout now internally renames unnamed equations to "__" (rather than Stata's
  default "_"); this fixes a number of issues (e.g. the issues addressed in 
  v3.25 and v3.26 using a different approach) and it also gives the user more
  control when addressing coefficients in options such as keep(), drop(),
  rename() etc.; specifying "_:coef" (or "__:coef") now specifically refers
  to "coef" in unnamed equations; in the old behavior "_:coef" addressed
  "coef" in any equation (i.e. same as specifying "coef" without "_:") and there
  was no possibility to address "coef" in unnamed equations only
- rename() did not work with names containing spaces; this is fixed
- refcat() did not work with names containing spaces; this is fixed
- -unstack- produced erroneous results if equations were not in order; this
  could happen if order() was used in a way such that the coefficients
  from an equation were divided into multiple sets interrupted by other
  equations; the problem is now fixed by enforcing ordered equations in case
  of -unstack-
- when using -unstack-, models for which the first element of cells() was
  not available were suppressed; this is fixed

24mar2022
estout.ado (3.29)
- the unicode translator introduced in 3.27 chopped lines after 200 characters;
  this is fixed
- blanks in coefficient names lead to erroneous results when more than one
  model was tabulated; this is fixed (Stata 11 or newer only)

24mar2022
estout.ado (3.27)
- in Stata 14 or newer, a subroutine is now called that escapes non-ASCII
  characters if the output format is RTF (the characters are translated
  to \u#?, where # is the base 10 character code); option -nortfencode-
  prevents this behavior

22mar2022
estout.ado (3.26)
- now using a different approach to fix the order()/unstack issue; this also
  fixes the second issue in https://github.com/benjann/estout/issues/33

21mar2022
estout.ado (3.25)
- order() together with -unstack- lead to erroneous arrangement of the table
  if there were unnamed equations; this is fixed
  (see https://github.com/benjann/estout/issues/33)

19may2021
esttab.ado (2.1.0)
- added support for (Multi)Markdown through option -md- or -mmd- (or file suffix
  .md or .mmd); md and mmd are synonyms; the changes are based on the suggestions
  made by Emanuele Bardelli (see https://github.com/benjann/estout/pull/24)

estpost.ado (1.2.1)
- pweights and iweights are now allowed by -estpost gtabstat-; proposed by 
  Kye Lippold (see https://github.com/benjann/estout/pull/27)

30apr2021
estout.ado (3.24)
- the value of the previous statistic was reported instead of missing, if the
  model p-value was requested, but the model contained no (nonmissing) F or 
  chi2 value; this is fixed
- the last format was used for all CIs if multiple formats were specified in 
  cells(ci(fmt())); this is fixed

17apr2020
- installation files added to GitHub distribution

08aug2019
estout.ado (3.23) and estadd.ado (2.3.5)
- changes from 07aug2019 undone because StataCorp will change Stata 16

07aug2019
estout.ado (3.24) and estadd.ado (2.3.6)
- Stata 16 introduced support for abbreviations in colnumb()/rownumb(); this
  new feature could cause problems in estout and in some estadd functions; 
  estout and the relevant estadd functions now include code to enforce old
  behavior of colnumb()/rownumb()

13jun2019
estpost.ado (1.2.0)
- estpost gtabstat added by Mauricio Caceres Bravo

31may2019
estout.ado (3.23)
- estout crashed if a coefficient name contained an apostroph ('); this is fixed
- style() caused error if used with -estout matrix()-; this is fixed (thanks to 
  Daniel Bela)
- indicate() did not work correctly if there were repeated models; this is fixed

01mar2019
estpost.ado (1.1.9):
- -svy:tab-: e(lb) and e(ub) were missing in cases where -svy- did not 
  provide e(df_r); this is fixed
- computation of p-values and CIs failed if degrees of freedom were larger than 
  2e17 (or lager than 1e12 in Stata versions < 10) (can happen with -mi 
  estimate-); this is fixed
- @span in the erepeat() suboption returned wrong result if labcol2() was
  specified; this is fixed
- element-specific drop()/keep() did not work as expected if coefficient names 
  contained spaces; this is fixed

06feb2016
estout.ado (3.20)
- if estout is called without without namelist and the active results are not
  among the estimates stored by eststo, estout now displays a note (suggested 
  by Nils Enevoldsen)
estadd.ado (2.3.5)
- the 28jan2016 update of Stata 14 broke estadd.ado; this is fixed
  (the update caused estadd to remove e(_estimates_name) from the active 
  estimates; a consequence of this was that results were no longer added to the
  stored copy of the estimates if estadd was applied more than once)
esttab.ado (2.0.9)
- when tabulating a matrix with more than one column in tex format, only one 
  column was defined in the tabular environment; this is fixed
- the alignment() option now allows multiple-column shorthand when tabulating 
  a matrix in tex format; for example, type alignment(*{5}{l}) if the matrix 
  has 5 columns that should all be left aligned
- the definition of the tabular environment in tex format did not always 
  contain the correct number of columns if the cells() option was used; this
  is improved

16jun2015
estadd.ado (2.3.4)
- -estadd local- now uses macval() to suppress macro expansion (only when 
  applied to active estimates and not for the display of the results)
estpost.ado (1.1.8)
- now uses macval() to suppress macro expansion in labels; affects subcommands
  -tabstat-, -tabulate-, -svy:tabulate-, and -stci-
- subcommands -tabstat-, -tabulate-, -svy:tabulate- and -stci- now have an 
  -elabels- option to enforce saving labels in e()
- subcommand -tabstat- now uses the actual by() values (instead of 1, 2, 3, ...)
  if a numeric by() variable is specified and labels are saved in e(labels)

02jun2015:
estout.ado (3.19)
- estout now supports Unicode in Stata 14
esttab.ado (2.0.8)
- added option -[no]float- to suppress/enforce table float environment in LaTeX

20mar2015:
estout.ado (3.18)
- cell contents longer than 245 characters was chopped off by -file write- when 
  writing the table cells; this is fixed
- computation of p-values and CIs from -mi- failed for coefficients for which 
  e(df_mi) was missing; this is fixed (using normal approximation)
esttab.ado (2.0.7)
- added option fonttbl() to set font table in RTF

02jun2014:
estout.ado (3.17)
- estout now compiles labels for levels of factor variables and interactions
- new option -interaction()- to specify delimiter for interactions
- new options -[no]omitted- and -[no]baselevels- to specify whether 
  omitted coefficients and base levels are included; the default is
  to include these coefficients
- the "o." and "b." flags are now removed from coefficient names
- estout no longer returns error if models use different base levels
esttab.ado (2.0.6)
- defaults for interaction() added
estout_mystyle.def
- entries for -omitted-, -baselevels- and -interaction- added

30may2014
esttab.hlp:
- clarified that explicit output format option will override format inferred 
  from file suffix

30may2014
estout.ado (3.16)
- estout now picks up e(df_mi) for the computation of confidence intervals and 
  p-values after -mi estimate, post-
- estout crashed on models with equation names containing "."; this is fixed
- estout now works on Small Stata
- estout no longer breaks on wide rtf tables
estadd (2.3.3)
- the -outcome()- and -split- options in -estadd prchange- did no longer work; 
  this is fixed
estpost (1.1.6)
- -estpost correlate- did not work in Stata 8; this is fixed

10oct2009
estadd (2.3.1)
- -estadd margins- added
- -adapt- option of -estadd listcoef- discontinued
estpost (1.1.5)
- -estpost margins- added
- -estpost svy: tab- now correctly returns the subpopulation number of
   observations in e(obs) if -subpop()- is specified.
   
06aug2009
estout (3.13):
- estout no longer chokes on factor variables in Stata 11

09apr2009
estpost (1.1.3):
- -estpost tabstat- now allows -columns(stats)-

25mar2009
estadd (2.2.8):
- support for -prvalue- and -asprvalue- from SPost added
- -estadd prchange- now adds outcome-specific results and average results
  by default; new -avg- option to store only average result and -noavg- to
  omit the average results; -adapt- option that was used in earlier
  versions to add the outcome-specific results discontinued

11mar2009
estout (3.12):
- "z" can now be used as a synonym for "t" in cells()
- cells(t(abs)) returned error; this is fixed
esttab (2.0.5):
- option -z[(fmt)]- added (z statistics)
estadd (2.2.4):
- improved formulas for coxsnell and nagelkerke (old formulas likely returned
  1 in large datasets)
estpost (1.1.2):
- -estpost tabstat- displayed wrong results (in each column the results
  from the last column were displayed; returned results were not affected);
  this is fixed
  
24feb2009
estpost (1.1.1):
- -estpost tabstat, statistics(semean)- crashed in some situations; this is
  fixed (thanks to Matthew Fiedler for reporting the bug)
- -estpost tabstat- now uses label "semean" instead of "se(mean)"
- -estpost tabstat- could crash if variables or statistics were repeated;
  this is fixed

16feb2009
esttab (2.0.4)
- -longtable- option added

10feb2009
estout (3.11):
- -order()- now adds extra table rows for elements not found in the table
- r(coefs) now respects -order()-, -keep()-, and -drop()-

21jan2009
estout (3.10):
- missing values (except .y and .z) in table cells are now treated like
  any other values
estadd (2.2.3):
- -estadd local- returned error if the specified string contained
  certain special characters; this is fixed
estpost (1.1.0):
- support for -svy: tabulate- added
- string variables are now allowed with -estpost tabulate-
- -estpost tabulate- returned a wrong e(sample) in some situations; this is
  fixed

08jan2009
estout (3.09):
- options in estout.hlp are now fully linked
- no longer wrapper for -estimates table-; now incorporates code from
  est_table.ado; still uses "undocumented" -mat_capp-
  => can now tabulate models that do not contain any coefs (e.g. stcox
     without predictors)
  => name space for coefficients is no longer restricted to names in e(b)
  => can now tabulate estimates without e(b) or e(V) (e.g. -factor-)
  => rule for merging e()-vectors: coefficients from e()'s without
     equations are merged into existing equations (without expanding the
     name space) if at least one e() does not contain equation "_" and
     no e() contains equation "_" along with other equations (and e(b)
     does not contain equation "_"); else: match by equation and expand
     name space if necessary
  => returns results in r() (r(coefs), r(stats), r(cmdline), etc.)
  => new rename() option to rename/match coefficients
  => el[#] and el[rowname] or el["rowname"] now possible to choose row of
     e(el) to be tabulated (support for el_# syntax discontinued)
  => cells(): new -transpose- suboption in -cells()-
  => new 'var' element (variance) available in -cells()-
  => existing e(se), e(var), e(t), e(p), e(ci_l), e(ci_u) now take precedence
     over internal computations (unless -margin- applies to model)
- -estout matrix()-, -estout e()-, and -estout r()- now available to tabulate
  a matrix
- new eqlabels(,merge) option => merge eqlabel into varlabel
- mutiple values may now be specified in modelwidth()
- cells(): parentheses can now be used to bind statistics in a row
- -nolabel- option in refcat() added
- an individual model can now be included multiple times in a table
- now uses abs() in formula to derive SEs of transformed coefficients
- now adds e(cmd)="." to current estimates if undefined (so that results
  without e(cmd) can be tabulated)
- no longer error if all coefs dropped
- fmt() can now be abbreviated as f()
- "\\" was not preserved in model titles taken from label of depvar; this
  is fixed
- @rtfrowdef now generally available (undocumented)
- fixed parsing of -cells- from defaults files
- fixed bug related to cells(ci(star))
- @modelwidth variable now available in par() suboption in cells()
  (undocumented)
- repeated elements in cells() now have their own set of suboptions
- coefficients containing blanks now allowed
- fixed alignment bug related to statistics with stars and pattern()
- in wide mode, empty columns in equations (due to keep/drop cell-subopts)
  are now suppressed
esttab (2.0.3)
 - -esttab matrix()-, -esttab e()-, and -esttab r()- now supported
 - no longer returns r(estout) since -estout- now returns r(cmdline)
 - -note()- now replaces the standard note
 - @starlegend is no longer default if user specifies -cells()-
 - -gaps- is no longer default if user specifies -cells()-
eststo (1.1.0)
 - new -prefix()- option
estadd (2.2.2)
- support for -prvalue- and -asprvalue- from SPost added (not documented yet)
- -estadd prchange- returns results differently; -add(all)- no longer
  supported; -add()- renamed to -pattern()-; type of main results now
  returned in e(pattern)
- now allows break key in subroutines
estpost (1.0.0)
 - new -estpost- command added to package

09apr2008
estout (2.86)
- user parameter statistics in cells() were suppressed under some
  circumstances if the -equations()- option was specified. This is fixed.
eststo (1.0.9)
- the -nocopy- option did not work. This is fixed.
- parsing in -addscalars()- has been improved (now binds parentheses/brackets
  and allows quotes)
- the -noesample- option returned error if a variable with the same name
  as the estimation set existed in the dataset. This is fixed.

18feb2008
estout (2.85)
- output is now suppressed if -using- is specified
- new -[no]outfilenoteoff- option (undocumented)
- -style(smcl)- is now default unless -using- is specified
- new -[no]smclrules-, -[no]smclmidrules-, -[no]smcleqrule- options
  (undocumented)
- new -note()- option (works like -title()-)
- model label row is now suppressed if only the active (unstored) model
  is tabulated
- -varlist()- now takes precedence over the labels generated
  by -eqlabels(none)-
- bug fixed related to the -vacant()- and -unstack-
- -se- was sometimes printed as "0" and sometimes as "." if the variance was
  zero; it is now always printed as "."
esttab (1.4.0)
- user provided significance symbols (-star()-) are now formatted
  depending on mode
- -addnotes()- is now printed before -legend-; -note()- added
eststo (1.0.7)
- -eststo drop- now allows wildcards
- -eststo dir- now shows list of stored estimates
estadd (2.1.4)
- new -quietly- option
- SPost subcommands added (-fitstat-, -listcoef-, -prchange-, -brant-,
  and -mlogtest-)
- -estadd- now passes through the caller version
- lists of added results are now printed (unless colon syntax is used)
- output was not suppressed in colon syntax if only one name was
  specified; this is fixed

29oct2007
esttab (1.3.8)
- -title()- and @hline were printed on the same line in -fixed- mode;
  this is fixed

27sep2007
estout (2.79)
- "&" can now be used in -cells()- to join parameter statistics together
  in one cell
- repetitions of elements in -cells()- are now possible
- "." can be used in -cells()- to insert empty cells
- -fmt()- now allows "%g" and "g" for "%9.0g" and "a" for "a3"; invalid
  formats (i.e. if not starting with "%") now return error
- e()-matrices with multiple rows can now be addressed using name_# in
  -cells()-
- new -topfile()- and -bottomfile()- options
- new -labcol2()- option
- bug related to -extracols()- and -mgroups()- fixed
- -abbrev- does no longer erase "." anymore
esttab (1.3.7)
- new -oncell- option
estadd (2.1.0)
- -estadd matrix- now also accepts matrix expressions
  (e.g. estadd matrix M = A*2)
- -estadd matrix- can now be used as -estadd matrix matname- or
  -estadd matrix r(matname)- (adds e(matname))
- -estadd scalar- can now be used as -estadd scalar scalarname- or
  -estadd scalar r(scalarname)- (adds e(scalarname))
- -estadd r(name)- now adds, depending on the nature of r(name), scalar or
   matrix e(name)
- -copy- option in -estadd matrix- discontinued
- "invalid subcommand" error message added
eststo (1.0.6)
- now sets e(cmd) to "." if undefined

30aug2007
estout (2.73)
- the -relax- suboption in options such as -drop()-, -keep()-, etc. is now
  documented
- -mlabels()- now has a -[no]title- option
- -eqlabels("",none)- did not work as advertised; this is fixed
- the -none- label suboption can now be specified without comma
  (e.g. -eqlabels(none)- instead of -eqlabels(,none)-)
- new options: -starkeep()-, -stardrop()-
- the text specified in -prehead()- etc. and in the -begin()- and -end()-
  label suboptions is now printed on a single line if it does not contain
  double quotes
- tab characters in defaults files are now allowed
- empty table rows did not display correctly in older RTF readers; this is
  fixed
esttab (1.3.5)
- -mtitles[()]- now uses estimates titles (if defined) even if -label-
  is not specified
- -addnotes()- now prints just one line if the string does not contains
  double quotes
eststo (1.0.5), _eststo(1.0.3)
- the caller version is now passed through
estadd (2.0.8)
- most functions now support variables with time-series operators

08aug2007:
estout (2.70)
- inclusion of string e()-macros is now possible in the -stats()- option
- Stata 10 uses "e(estimates_title)" instead of "e(_estimates_title)"; this
  is now recognized
- -elist()- and -blist()- in -varlabels()- can now write multiple lines
- some bugs fixed
esttab (1.3.4)
- -cells(none)- now produces better tables
- not all -estout- options were always passed through correctly; this is
  fixed

30may2007:
esttab (1.3.2)
- bug fixed related to equation lines in -fixed- mode
- the -plain- option does not suppress the column labels anymore

22may2007:
estout (2.64)
- "too many literals" bug fixed
- new -wrap- option
- the -stats()- option now has a -layout()- and a -pchar()- suboption
- first element in -cells()- now sets the default display format (in earlier
  versions, the default format was set by the -b- element)
- the -nofirst- and -nolast- suboptions in -varlabels()- now apply
  equationwise
- new @rtfrowdefbrdrt and @rtfrowdefbrdrb variables (undocumented)
- the label_subopts -elist()-, -blist()-, -begin()-, -end()- now also support
  the @M, @E, @width, @hline, and @rtfemptyrow (undocumented) variables
- new -[no]first- label_subopt
- new -replace- label_subopt to overwrite -begin()- and -end()-
esttab (1.3.0)
- -esta- renamed to -esttab-
- lines between equations are now supported; new -noeqlines- option
eststo (1.0.4)
- -esto- renamed to -eststo-

13apr2007:
estout (2.58)
- robust parsing of cells() if there are spaced between elements and their
  options
- new -cells()- suboption called -pvalue()-
esto (1.0.3)
- -by- prefix command now supported
- new -missing- option to be used with by prefix

16mar2007:
estout (2.56)
- bug fixed related to -cells(..(drop()))- with -unstack-
- new elements for -cells()- called -_star-, -_sign-, and -_sigsign-
- bug fixed related to -transform()-
- new -[no]asis- option (undocumented)
- new -[no]smcltags- option (undocumented)
- -style(smcl)- now includes horizontal lines
- new -cells()- suboption called -vacant()-
- -prefix()- and -suffix()- in -varlabels() now also applies to
  -refcat()- and -indicate()-
- bug fixed related to spaces in -mlogit- equations
esta (1.2.6)
- improved smcl mode
- LaTeX column specifiers are now compiled if -cells()- is
  specified (-stardetach- not supported)
- column labels are now printed if -cells()- is specified
estadd (2.0.6)
- e(_estimates_name) is now backed up in e(_estadd_estimates_name) while
  working on the estimates set

23feb2007:
estout (2.50)
- new @width variable
- prefix() and suffix() are now added to labels *after* abbreviation
esta (1.2.4)
- new -smcl- mode; -smcl- is the new default
- bug fixed related to leading spaces in labels in -scalars()- labels
  (length of the labels is now restricted to 80 or 244, depending on
  Stata flavor)

04feb2007:
estout (2.49)
- new -dropped()- option
esta
- ** was used instead of *** for p<0.001 in -rtf- mode; this is fixed

04jan2007:
estout, estadd, esta, and esto are one package now
estout (2.48)
- rtf support added (undocumented: @rftrowdef and @rtfrowdefbrdr in
  begin(); @rftemptyrow in varlabels(,end()))
- drop()/keep()/order() etc. now have a -relax- option (undocumented)
- -starlevels()- now has -label()- and -delimiter()- suboptions
  (undocumented)
esta (1.2.0)
- -append- implemented for -tex-, -rft-, and -html-
- improved -rtf- compatibility
- -page(packages)- now adds "\usepackage{packages}" to LaTeX documents
- -csv- mode now uses comma; new -scsv- mode (semi-colon separated)
- default file extensions implemented (.txt, .csv, .rtf, .tex)
- italics implemented for -rft-, -tex-, -html- in labels such as "R^2"
- bug fixed related dropping constant (usage of -drop(_cons, relax)-)
- symbols and thresholds may now be specified in -stars()-
estadd (2.0.5)
- r()'s are now always restored
- bug fixed related to e(_estimates_name)
- estadd now also works if current estimates do not contain e(cmd) or,
  in fact, are completely empty

30nov2006:
estout (2.45)
- usage of * and ? wildcards in -drop()-, -keep()-, etc. now independent
  from the variable names in the active dataset
- * and ? wildcards now allowed in equation names in -drop()-, -keep()-, etc.
- bug fixed related to @hline>400
esta (1.1.4)
- new -rtf- mode
- bug fixed related to -nodepvar- in -tex- mode
- r(cmd) renamed to r(estout)
- -nogaps- now default for -not-
- bug fixed related to notes
- new -main()- option
esto (1.0.1)
- does not drop e(sample) by default
- new -_esto- command
estadd (2.0.2)
- bug fixed related to "GetRidof_estimates_name"
- new -lrtest- subcommand

16nov2006:
estout (2.43)
- bug fixed related to -eqlabels()- and -mlabels()-, if less labels than
  equations/models were specified
- -est tab ..., equations(main=1)- is now used if models have
  different first equations (unless -unstack- or -equations()- is
  specified).
- new -transform()- option
- new -refcat()- option
- new -indicate()- option
- bug fixed related to -noabbrev- in -style(fixed)-

04nov2006:
estout (2.37)
- new -order()- option; -keep()- does not change order
- * and ? wildcards now allowed in -keep()-, -drop()-, etc.
- new -extracols()- option
- $esto is only used if the inicated estimates are available
- bug fixed related to column delimiter in -style(fixed)-
- bug fixed related to repeated equations
- "equation:_cons" is now replaced with equation label if
  -eqlabels(,none)- is specified and "_cons" is only parameter in equation
esta (1.1.0)
- new -width()- option
- note "(output written to ...)" added
- -notype- is now default if -using- is specified
- new -align()- option
- new -fragment- option
- new -noisily- option
- new -csv-, -tex-, -tab-, -html-, and -booktabs- options
- file suffix now determines mode

21oct2006:
estout (2.35)
- -tab-, -fixed-, -tex-, -html- now internal styles; -estout_mystyle.def-
  provided
- "estoutdef.ado" deleted from package
- *.style renamed back to *.def
- @E variable added (total number of equations)
- bug fixed related to abbreviation and -numbers-
- @span now supported in label_subopts -begin()- and -end()-

21sep2006:
estout (2.31)
- changed default value for -discrete()-
- e(sample) is now fixed if observations have been added to dataset
- labels_subopts -end()- und -begin()- now feature multi-line strings
- new -numbers- option
- new -a#- display format (adaptive format)
- new -#- display format (fixed format)
- -varwidth()- now depends on -labels- with -style(fixed)-
- global macro -$esto- now recognized
- *.def renamed to *.style
estadd (2.0.0)
- new syntax: -estadd subcommand, opts: estimates-
- subcommands now included in "estadd.ado"
- new -local-, -matrix-, and -scalar- subcommands
- -estadd_plus- package now incorporated into -estadd-
esta (1.0.0) released on SSC
esto (1.0.0) released on SSC

12jun2006:
estout (2.21)
- new @hline variable and -hlinechar()- option

02jan2006:
estout
- bug fixed related to Stata 9.1 and e(estimates_title)

02dec2005:
estout (2.18)
- internal default values added
- bugs fixed related to the 503 character limit of the -:word of-
  function

08jun2005:
estadd/estadd_plus
- subcommands are now named "estadd_subcmd" (old: "_estadd_subcmd")
- now also applies to the stored copy of the active estimates in any case

13may2005:
estout
- equation name now allowed in -varlabels()
- speed improvements
estadd (1.0.5)
- estadd is separate package now
- new simplified alternative syntax for use with active estimates
- new -replace- option; changed default: overwriting not permitted
- all subcommands as separate ado files
estadd_plus:
- new subcommand called  -pcorr-

15apr2005:
estadd (1.0.3)
- support for e(subpop) added
- estadd_plus released on SSC; contains -summ-, -vif-, -ebsd-, -coxsnell-,
  and -nagelkerke- subcommands

22mar2005:
estout (2.15)
- new introductory "estout_intro.hlp"

14feb2005:
estout (2.15)
- invalid suboptions in -cells()- now cause error

04feb2005:
estout (2.14)
- improved handling of labels for time-series variables

28jan2005:
estadd (1.0.2)
- new -summ- subcommand

30nov2004:
estout (2.13)
- new naming convention for defaults files
- new "fixed" style
- new -style()- option; replaces -defaults()-
- multiple formats may now be specified for parameter statistics
- last format in -stats(,fmt())- is now used for remaining stats
- "(dropped)" was not displayed with all models; fixed
- empty "significance symbols" now possible
- valid range for starlevels now (0,1]
- new estadd command; support for subcommands canceled
- -stdev- subcommand renamed to -sd-

11aug2004:
estout (2.05)
- bug fixed related to drop()/keep() in -cells()- and -unstack-
- support for -mfx- with multiple equation models; new meqs() option

04aug2004:
estout (2.04)
- new -mgroups()- option
- new -blist()-/-elist()- suboptions in -varlabels()-
- new -substitute()- option
- bug fixed related to typing special characters
- support for -mfx- added (single equation models only)
- bug fixed related to model labels
- // and /// comments now supported in defaults files
- new -erpeat()- suboption in mlabels(), eqlabels(), and collabels()

27jul2004:
estout (2.00)
- new syntax: -cells()- now determines the table contents
- new -beta-, -mean-, and -stddev- subcommands
- confidence intervals
- summary statistics for each equation in -reg3-, -sureg-, and -mvreg-
  (if -unstack- specified)
- new -varlabels()- and -mlabels()- options
- labels_subopts: prefix()/suffix(), begin()/end(), none
- -unstack- equations
- overall-p-value
- introduction of @variables
- introduction of defaults files
- new -dmarker()- , -msign()-, and -nolz- options
- ... and many other changes
estout v1 now available as estout1

12jun2004:
estout (1.02) released on SSC

estout's People

Contributors

benjann avatar mcaceresb avatar nilsenevoldsen avatar sergiocorreia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

estout's Issues

estout: minor issue with formatting of confidence intervals

Dear Mr. Jann,

First of all thank you very much for the estout command, it is a godsend.
I came across a small issue for formatting the confidence intervals.
Basically, when custom number formats are specified, only the last one prevails.
For instance, if I have 3 coefficients and type:

estout, cells(ci(fmt(1 1 2)))

All CIs will show 2 decimals.

I identified the issue in the ADO file, and fixed it as best I could.
On row 1,513 the current code is:

local format: word `r' of `ci_fmt'

I changed it into:

local format: word `r' of ``vi'_fmt'

I think the fix is correct. At least it solved my issue and the CIs now show the desired number of decimals.
But the code is a bit overwhelming so I hope it doesn't mess with the rest of the code.

Very best,

Marc

how to modify the lables of the equations?

I want to replace the labels of the equations to be 1, 2, and 3... how to do this?

sysuse auto,clear

eststo clear

estpost corr price mpg rep78 trunk weight,matrix

esttab using "corr1.rtf", replace cells("b(fmt(3) star)") nonumbers noobs nomtitle not nogaps unstack label eqlabels(,none) compress 

image

I also want to supress the correlations 1 (the correlations of the variable itself), can we?

cannot treat `indicate()` option correctly if use `order()` & `unstack` option simultaneously

The estout packge is amazing and it helps me a lot when I doing my research.

however, when I try to output my analysis result computed by regress & ivprobit with mle estimation, something occurs.

it is because esttab cannot ouput r-square for the first-step result of ivporbit (p.s. mle estimation does not use two-step but the usage of "first-step" makes my issue more clearly and simply), I put a regression of first-step manually and try to out put them together use esttab.

however, when I use indicate order and unstack simultaneously, all Factor variables display "No". If I use them separately, the result displays well.

I will show you my commands and a sample of my data to ensure the problem replication.

command I use list as follows

ssc install estout, replace
version 16.1
reg X IV c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 i.f1 i.f2 i.f3, cluster(id) 
est store m1
ivprobit Y (X = IV) c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 i.f1 i.f2 i.f3 , vce(cluster id) nolog
est store m2
* if not specify unstack or order, result display correctly
esttab m1 m2, order(X IV) i("F1 = *.f1" "F2 = *.f2" "F3 = *.f3") star (* 0.1 ** 0.05 *** 0.01) b(3) ar2(3) pr2(3) se(3) compress nogap
esttab m1 m2, unstack i("F1 = *.f1" "F2 = *.f2" "F3 = *.f3") star (* 0.1 ** 0.05 *** 0.01) b(3) ar2(3) pr2(3) se(3) compress nogap
* if specify unstack with order, result display uncorrectly
esttab m1 m2, order(X IV) i("F1 = *.f1" "F2 = *.f2" "F3 = *.f3")  unstack star (* 0.1 ** 0.05 *** 0.01) b(3) ar2(3) pr2(3) se(3) compress nogap

sample of my data as follows

* Example generated by -dataex-. For more info, type help dataex
clear
input byte Y float X byte IV float(c1 c2) double(c3 c4 c5) byte c6 float c7 byte c8 float c9 byte c10 double c11 int f1 byte(f2 f3) long id
0            0 1  23.46837   .006541886  .584785 .259396  .945744 1 21.9283  7  .4285714 0    -.11655366675306045 2019 10 2      6
1      .931652 1  23.19192     .0186401   .78998 .063562  .754897 0 34.3563  9  .3333333 0      .1977455340583456 2018  5 1     18
0            0 1  26.02094  -.001736022  .771622 .156775 1.060117 1 49.2763 11  .3636364 0   -.010866227145588936 2020 10 4     31
0            0 1 23.016335   .012496668  .474905 .233348  .689768 0 31.2136 11  .3636364 0    .005297819125023917 2018 10 1     36
0     .6864821 1  21.87479   .017915009  .096148 .342849  .665288 0  21.424  6        .5 1     .27582669998569753 2020 11 2     38
0            1 0 23.573277   .002382931  .365806 .487525  .900957 0 30.9812 11  .3636364 1    -.17572801194276777 2016 10 4     40
1      .981386 1  23.30763  -.005051685  .561924 .009116 1.071822 0 21.6015  9  .3333333 0     -.6148126419216235 2018 10 4     56
0            0 1 26.018044    .01091604   .69921 .126205  .977708 1 24.2327 15  .3333333 1    -.07596493372714253 2018  3 3    338
0     .6569666 0  21.51874   .013169032  .687026 .093621  .556728 1  31.787  9  .3333333 0    -.11737896775579348 2017 13 2    430
1            1 0  22.42486   .010241698  .339621 .440422  .431784 0 18.8779 11  .3636364 0                      0 2017  6 2    516
1     .4899617 1 23.288143   -.01749491  .560025 .056537  .436076 0 29.7449  9  .3333333 0     -.6006745103969204 2021 16 3    516
0            0 0  22.40464   .012537514  .370047 .082347   .74342 1 19.9556  9  .3333333 0    -.11634206159438198 2017  3 2    530
0            0 0 21.560545   .018766297  .334181 .262158  .497236 1  30.312  8      .375 0    -.11668189565184095 2016  7 2    548
1     .9116874 1 21.246815  -.003457195  .344483 .024151  .612639 0 40.9405  9  .3333333 0    -.07784820660390424 2018  4 1    593
1      .986315 1  23.31573  -.004962781  .783798 .094795  .931482 0 37.0361  9  .3333333 0    .013097731488616926 2019 10 3    615
0            0 1 25.332537  .0025077634  .530055 .236704 1.062829 1 21.5571 14  .5714286 0   -.024067825172208845 2018  3 2    625
1     .9999999 1 26.296926   .008612957  .844228 .123185 1.064735 0 18.0372 11  .3636364 1     .04479371502954366 2018 10 4    671
0            0 1 20.553326  .0045889206  .193143 .115185  .302466 0 23.1487  9  .3333333 0 -5.396414033298491e-06 2020  3 2    677
0            0 0  22.95249  .0009692671  .613174 .135704  .760235 1 27.6248  9  .3333333 0    -.07122257922276476 2017  3 3    680
0     .7369868 1  23.90527    .01221528  .509455 .057126 1.062701 0 33.6992 12  .3333333 0    -.13049502926040724 2019  3 2    683
0            0 1 20.837915    -.1182104  .572671 .113313  .578655 1 25.1346  7  .4285714 0    -.07392728860584852 2021  3 2    702
0            0 1 21.568424  .0088016745  .351822 .083551  .832347 1 19.9411  8      .375 1    -.07400341192740123 2019  6 3    705
0            0 0 22.408474    .01693302  .336944 .068215  .787301 1 29.9549  9  .3333333 0     .10766481792697169 2016  3 2    708
1            1 0  20.48228  -.019285915   .41808 .050187  .393641 0  29.728  9  .3333333 0     -.6350792050361633 2015  3 3    723
0           .5 0  24.17106 -.0005589074  .421673 .044988  1.03649 1 24.5133  9  .3333333 0    .062074019290166316 2016  3 3    727
1            1 1  26.21689   .007330722  .868842 .047537 1.063074 0 48.9695  7  .4285714 1     .18378027834930188 2018 10 4    732
1            1 0 22.488445   .007887862   .37082 .143391  .643284 0 17.1438  7  .4285714 0    -.08303293121949185 2017  1 2    735
1            0 1 22.163485    .04025276   .41607 .060288  .526782 0 28.7391  9  .3333333 0    -.08435569512274099 2018  3 4    818
1            0 1 24.283895   .008866069  .563923 .108443  .755345 1 16.5631  9  .3333333 0    -.11185501474792003 2018 13 1    826
1     .9563587 0  21.04916   .005275281  .723027 .044186   .34623 0      16 12  .3333333 0    -.00932005846570827 2017  3 2    835
0            0 1  23.91804   .012171192  .728021 .084915  .935231 1 63.7759  9  .3333333 0    -.05721366980782239 2018  3 3    951
0     .9921135 0  21.99486   .003200878  .045888  .21997  .410353 0 15.5054 11  .3636364 0    -.03620999534668101 2016  9 3    971
0     .7076803 1 23.249954   .027880866  .170929 .019767  .491508 0 15.7377  9  .3333333 0    -.14603524429220283 2020  2 2    975
0            0 0  21.70412   -.03122518  .425738 .042634  .509971 1      16 15  .3333333 0    -.04114783133753397 2016 13 4    978
0     .4118111 1 23.228773   .006608562   .48451 .168233  .553162 0 29.5884  5        .4 1    -.10578884623808715 2019  9 4    997
0    .11145928 1   21.9399   .028344434  .208003 .294275  .644397 0 33.7485  9  .3333333 0    -.05498129542436203 2021  3 1   2026
1            0 1  23.49621   .009799164  .420781 .110208  .589225 0 20.4132 11  .4545455 0    -.13643013622435207 2018  9 4   2065
1      .995297 0  21.84675   .020259835  .645872 .056661  .430803 0 34.8472  8      .375 0    -.11498395856922006 2017 17 2   2071
1     .7691944 0 21.517035   .005613637  .525038 .049952  .559337 0 33.1068  7  .4285714 0     -.2073176004196866 2017  3 4   2076
0     .5726156 0 23.735254   .011374236  .619114 .060514  .815505 0 55.8754  7  .4285714 1    .022001220513940156 2016  3 2   2078
1            1 0 22.010984   .000543693  .218926 .115767  .603424 0 35.1898  9  .3333333 1      -.275883887212102 2016  1 1   2086
1     .9991736 1 22.128185  .0007240294  .264203 .086587  .676367 0 27.9192  9  .3333333 1     -.3023150080763912 2018  1 1   2086
1     .9998389 0  22.21816    .07421203  .386889 .157778  .468513 0 22.1626  7  .4285714 0    -.19427643826624996 2017  3 2   2094
1     .9974306 0  22.72781   .009052862  .682001 .058711  .708496 0 41.0186  9  .3333333 1    -.44110169842582236 2015  3 3   2121
1     .9784886 0  23.41279   .006868779    .6801 .119318  .799269 0 43.1582  9  .3333333 1    -.05238845983289375 2017  3 2   2121
1     .9647424 0 23.457254   .007575728   .68176 .087537  .799617 0 43.1362  9  .3333333 1    -.10116164811614736 2017  3 4   2121
1     .4627682 0 22.515156   .006606665  .546047 .076851   .60711 0 24.4453  7  .4285714 0     .07938299075279942 2017  3 2   2130
0 .00005696172 1  24.14001   .010082267  .638599 .091504  .738933 0   34.48  9  .3333333 1     .01651840290691542 2021  3 3   2203
0     .3630657 1 20.956406   .006260512  .372676 .050175  .405019 0 38.2124  5        .5 1     .38658734468607814 2018  3 2   2211
0     .6632438 0 22.496624   .024247756  .429839 .171623  .296507 0 48.1985  9  .3333333 1    -.09406542526262318 2015  3 4   2242
0     .7658159 0 23.312296    .02627352  .482263 .172226   .42112 0 29.5417 12  .3333333 0    -.09112069846520099 2017  3 4   2271
1     .7135918 1  23.70143   .021362694  .588407  .23567   .72431 0 29.6815 12  .3333333 0     .09541242903506242 2018  3 4   2271
0     .3925216 1 23.116613   .008775233  .513507 .186994  .968672 1 39.5067  9  .3333333 0    -.09745953982209754 2020 10 2   2285
1            1 0  23.61587  -.006748697  .734712  .06596  .894327 0 46.6676  9  .3333333 0     -.6186078538600104 2015  3 3   2309
1     .6098942 1  22.65274  -.005768759  .701191 .055315  .580472 0 24.6875  7  .4285714 0     .21706269725925886 2018  3 4   2313
1     .5116827 0  22.07821   .007702809  .376907 .039988  .487159 0  37.142  8      .375 1     -.5534196560013007 2015  3 3   2329
1     .9306198 1 21.223305  -.005161433  .191957 .018125  .552919 0 51.6813  7  .4285714 0     .12731100929346684 2018  3 2   2330
0            0 1  22.51812    .02537733  .471277 .114011  .332187 1 21.5549  9  .3333333 1      .3178894835848165 2020  3 2   2332
0    .17118557 0  22.45576   .009270319  .592059   .2165  .689021 0 48.2225  9  .3333333 1     .11836689496996455 2016  6 4   2336
0    .27657926 0 20.960585     .0166675  .189455  .22899  .440394 0 21.2228  9  .3333333 0     -.1317195583003028 2017  3 2   2360
0    .04205631 0 20.738434    .01462423  .145831  .07232   .18168 0 22.1239  9  .3333333 0     .49925092568614504 2017  3 3   2362
0      .749568 1 22.632803    .01335316  .224746 .139084 1.122952 0 36.8905  9  .3333333 0    .003174701123921153 2018 10 4   2377
1     .6310511 1 21.458397    .00811147  .181288 .156579  .714572 0 20.0958  9  .3333333 0     .15122049177817387 2018  3 1   2381
1           .5 1  23.18832    .00532092  .445859 .122432  .650856 0 21.0432 12  .3333333 0     .14242293219291557 2018  3 1   2390
1    .13146408 1 21.873865   .015368367  .248201 .038347  .671725 0 17.5816  9  .3333333 1                      0 2018 12 1   2398
0    .52650857 1  22.88623    .00290217  .544582 .056325  .672527 0 12.7912  9  .3333333 0     .18495277734569293 2019  3 3   2407
0            0 0 22.141815 -.0003614263  .204623  .06391  .374122 0 38.3181  7  .4285714 1     .10748921304322945 2017  3 3   2414
1       .97698 1  22.51107    .03252425  .343281 .091285  .578911 0 53.4631  9 .44444445 0     .20396482737072064 2018  3 4   2424
1     .3578187 1 21.499405    .02410278    .2391 .123387  .491256 0 30.4942  6        .5 1      1.114539876975416 2020  3 1   2432
0     .1985171 1  20.94404 -.0026766805  .448899 .057397  .345682 0 40.2277  7  .4285714 1    -.09155239173505625 2020  3 2   2451
1     .9350094 1   21.4925   .004653505  .427631 .054316  .539903 0  46.399  9  .3333333 0    -.17808484184770623 2018  1 1   2458
1    .58759856 0 22.239737   .011132246  .426752  .05014  .394206 1 32.9399  9  .3333333 0    -.30959203420320003 2016  3 1   2481
1      .849029 0   22.1377   .006715558   .36084  .04124  .377394 1  34.451  9  .3333333 0    -.13131395033913285 2017  3 1   2481
1     .8978257 0  21.98176   .018976565  .066125 .198252  .555553 0 26.8905  9  .3333333 0    -.08968978862344601 2017 17 2   2502
1     .5749914 1  23.39429  -.008274672  .701291 .020682  .566602 0 20.1242  7  .4285714 1     -.5107979040709122 2020  3 1   2506
0            0 0  22.14512   .007782157  .411673  .08289  .737374 0 19.3804 11  .3636364 0    -.23618537517202676 2016  3 1   2513
1     .5190855 0  22.62843   .007223045  .666378 .075301  .732954 0 51.7855  9  .3333333 1    -.08915782628295044 2016  3 1   2516
1     .6882586 1 22.190763   .001543706  .118335 .077017  .939936 0 45.6486  9  .3333333 0     .06951263157901355 2018  3 4   2516
0      .582819 0  21.32488    .01048358  .132721 .223256  .417493 0 18.6758  7  .4285714 0     -.2822090882974412 2016  3 3   2529
0      .991421 1  21.35625 -.0041242265   .25722 .026322  .757773 0 18.6758  6        .5 0    -.13923760373295324 2019  3 1   2529
0            0 1 24.510195    .02633591  .701285 .013977   1.2168 0   23.48  9  .3333333 1     .29988611896459805 2020  3 2   2532
0     .4285714 1  23.04207   .006420465   .58061 .097543  .875196 1 29.2779  9  .3333333 1     .07116975239085699 2020  5 3   2542
1      .342749 0 20.912077 -.0016797663  .331209 .067539  .432202 0 64.5093  8      .375 0                      0 2015 13 3   2549
1      .370618 0 20.848215   .007533599  .193778 .122771  .233189 0 64.5093  8      .375 0    -.16174510227651806 2017 13 2   2549
1     .7219743 0 21.382927   .025429364  .224064  .08548  .690184 0 42.2364  9  .3333333 1    -.33219447561476656 2017  3 2   2571
0     .3643026 1  20.62912  .0024850864  .045888 .101991  .400384 0 44.8521  6        .5 0      .2483188576050539 2018  3 3   2575
1            1 0 23.410753  .0011212789   .57184 .231417  .820575 0 15.6558  9  .3333333 1   -.012032504977274372 2016  3 1   2610
1     .7983786 1  21.48174 -.0041963775  .615567 .287986  .774453 0 51.5108  8      .375 0    -.08470062636245157 2020  3 2   2615
1     .9115749 0 21.960415   .002443449  .319653 .044632  .612902 0 26.7526  9  .3333333 1     -.1623094140805339 2017  3 2   2639
0     .7072687 0  21.59865   .020402573  .208345 .152655  .288401 0 22.2976  9  .3333333 1    -.33196838434399223 2015  6 2   2640
1            1 1   23.2325  -.017375221  .404433 .076527  .668864 0  18.187  9  .3333333 1   -.028948199517911277 2018  6 4   2640
0      .556566 1 20.848154 -.0041634594  .545086 .043104  .288331 0 15.2722  9  .3333333 0    -.32256944530064413 2020  3 1   2655
1     .8010126 1  21.93639  -.011914815  .285298 .084275  .716213 0 28.5634  7  .4285714 0     -.2908502017767989 2018  3 4   2656
1  .0009701049 1 22.930727 -.0022225392  .167395  .41351  .626943 0 20.0177  9  .3333333 0     .04160562054728323 2018  3 1   2665
1     .8957849 0 22.026474    .01939695  .426996 .054574  .821176 0 27.2823  9  .3333333 0     -.1473419285452654 2017  3 4   2671
1     .6494189 0  21.75721  .0045995745  .171421 .256501  .706801 0 28.0444  7  .4285714 0     -.2291572837987753 2017  3 2   2674
1     .6895479 0 21.837187   .032463256  .216014 .074483  .422054 0 44.9487  7  .4285714 0      .8364884687459839 2015  3 3   2681
1     .6310632 0  22.15345    .02070435  .299201 .073333  .404426 0  44.537  9  .3333333 1    .051787568568377296 2017  3 2   2681
1     .9585486 1  21.99116    .04749272  .450857   .0208  .288879 0 52.4058  8      .375 1   -.056044579584112464 2018  7 1   2711
0     .7650604 1 20.404306   .006018405  .322787 .044424  .462926 0 21.6254  7  .4285714 0     -.1312791376208874 2019  3 3   2715
1     .9027508 0  22.47264   .005777257  .660709 .013812  .821545 0 33.7341  8      .375 0                      0 2015  3 3   2716
0            0 1  20.71438   -.07405326  .412561 .051183  .488725 0 29.3194  7  .4285714 0    -.04733867345714238 2018  3 4   2723
0            0 0 22.061296  -.009817184  .315831 .127236  .530697 0 41.6164  9  .3333333 1   -.061597975845205766 2016  3 3   2737
1     .9481014 1  21.68237   .004915435  .396768 .136516  .848198 0 23.8905  8      .375 1   .0035598943172787667 2018  3 1   2740
1     .7999068 0 22.020777  -.013915107  .549905 .223632  .673259 0 45.3136  6  .3333333 1    -.27238514859880225 2017  3 4   2766
1      .318254 0  21.37551    .02417484   .51316 .048042  .564048 0    52.5  7  .4285714 1    .014436309071632625 2017  3 2   2768
1     .6650006 1  20.99927   .007399396  .495889 .100304  .748179 0 51.0156  7  .4285714 0    -.33615121245384216 2018  5 3   2856
1      .745595 1 21.156986  -.025304386   .58245 .085945  .790942 0 51.0156  7  .4285714 0    -.08170498822775163 2019  5 4   2856
0            0 1  20.06174   .017579691  .158399 .205815  .414944 0 62.7782  7  .4285714 0     .10074137946108208 2021  3 2   2888
0            0 1  21.74554   .023523184   .34932 .265262  .313821 0 28.9815  9  .3333333 1    -.29569917294234616 2020  3 3   2891
0     .1186291 0  22.32478   .002874133  .319676 .043669  .413086 0 19.3454 12  .3333333 0     -.2116825372417772 2016  9 1 300010
1     .2725401 1 22.341627    .01704489   .33201 .104638  .595541 0 20.9055  9 .44444445 1     .37885174631782204 2021  9 3 300031
1     .7401816 0  22.51858   .008415059  .579887  .05341  .541964 0 32.7698  7  .4285714 0     .14449894794704043 2017  3 2 300043
1     .7437187 0 20.865105  .0081653185  .415402 .157196  .245934 0 27.8554  7  .4285714 1    -.17818031869209772 2017  9 2 300052
1            1 1 21.691767   -.14534728  .629544 .063097   .81314 0  14.893  9  .3333333 1     .06593332979165667 2018  3 4 300056
0     .5003876 1 22.135046   .020528555  .182719 .113135  .829906 0 26.1496  9  .3333333 0     -.4001265834309844 2018  3 2 300061
1     .6036838 1 21.549654   .017761713  .238457 .291283  .386285 0 21.5828  5        .4 1     .04468417758148835 2018  3 1 300065
1     .6321993 1 21.497147   .010999167  .215061 .149415    .5741 0 19.6405  5        .4 1    -.12484560900074804 2018  3 4 300065
1     .6636558 1  21.46057  -.007652415  .298533 .127019  .494445 0 19.6405  5        .5 1    -.02117938495628635 2020  3 1 300065
1     .7558506 1  24.59995  .0034404655  .575319 .109056  .671653 0 22.8544  7  .4285714 0    .009760280229569318 2018 13 1 300070
0            0 1 22.198923  .0011995313  .122977 .374279  .600923 0 15.0047  6        .5 1    -.22826938183058232 2019  3 3 300079
1     .8215045 1  21.79581  -.006897378  .384651 .036622  .853649 0 17.8646  7  .4285714 1      .0963941975647351 2018  2 1 300084
1     .4577186 0  21.41663  .0044656834  .577435 .020557  .420296 0 18.1627  9  .3333333 1    .003703753803175447 2015  3 3 300091
0     .9999006 0 21.464367  .0021726605  .147185 .122813   .43592 0  16.974  7  .4285714 0      .6594421950675684 2015  3 1 300102
1     .8371637 1 22.302826    .02647491  .536661 .034719  .867827 0 23.9152  7  .4285714 1    -.34659107476329354 2018  3 4 300108
0            0 1  21.46671   .014307636  .266921 .190325  .316445 1      26  9  .3333333 0    -.03813938372966974 2019  3 1 300114
1     .7316653 0 21.953865   .003876171  .397461 .086579  .518696 0 21.3033  5        .4 1     -.2325990066834941 2017  3 2 300128
1     .5049037 1  23.07233   .012514503  .535729 .070698   .64343 1 26.6482  7  .4285714 0     .01668124858877751 2018  3 1 300145
0    .40322515 1 21.785473  -.003251654  .136258 .137927  .873306 0 12.7023  5        .4 0     .21332207056032915 2021  9 3 300148
0            0 0 20.450235   .022454957  .045888 .127387  .097598 0 24.0929  7  .4285714 0    .011023936087231512 2016  3 2 300149
1     .9409711 0  21.84431  -.006607469  .487311 .045883  .487593 0 29.5006  7  .4285714 1    -.26129752700733455 2017 13 3 300152
1            0 0  21.12339   .003530235  .227306 .222957  .484769 0 37.3834  7  .4285714 0    -.19616798837255855 2017  3 2 300155
1     .9990442 0 21.662207    .01981125  .337769 .228359  .464939 0 21.2091  9  .3333333 0    -.22905385862484795 2017  3 2 300173
1     .8238848 0 21.838757   .014923182  .545304  .13564   .29186 0 32.9028  9  .3333333 0     -.5780982598913436 2015 11 3 300178
1     .6841965 1  23.76799  -.003507872  .699027 .179648   .75003 0 41.7622  7  .4285714 0    -.00390466110249299 2018  5 1 300197
1     .9046198 1 22.493786   .017588392  .325769 .306619   .47358 0  25.365  7  .4285714 0     .02298700740813997 2018  3 1 300199
1            1 1 21.813334  .0045026415  .340014  .26494  .606351 0 14.4603 10        .5 0        .31728735149205 2018  3 1 300213
0     .9873234 1 21.931715 -.0030190675  .332804 .048892   .59194 0 20.9516  7  .4285714 0     -.2837515542488247 2018  3 2 300221
1     .6704647 1   22.5823   .015625594  .591352 .130462  .701814 0 41.4058  7  .4285714 1     .11049772965371907 2018  3 4 300232
1     .5314783 1  22.71992  .0008975485  .524161 .074754  .703096 0 33.6348  7  .4285714 1     -.3865788486199717 2020  3 2 300232
1     .8648745 1  22.82934    .01593557  .575679 .035719  .533969 0 26.2884  9  .3333333 0   -.036146927037850496 2018  5 1 300237
1     .3311583 0  20.38745   .036520425   .24516 .157818   .21899 0 33.5275  9  .3333333 1    -.11836174899914287 2017  3 2 300246
1     .7832754 0  21.78255   .005978856   .18192 .157715  .612162 0 14.4376  9  .3333333 1     -.0445251219166084 2017  3 2 300247
1     .9857481 1 22.913004  .0025120245  .610037 .045022  .925322 0 13.4828  9  .3333333 0    -.15554742990987314 2018  3 1 300256
1            0 0  20.78806   .007994743  .376146 .062202  .511801 0 28.1211  7  .4285714 1      -.144889711556364 2017  3 2 300260
1     .6979561 1 22.403843  -.006904245  .568191 .050863  .856025 0 41.6943  7  .4285714 0     .40191864392808285 2018 13 4 300262
1    .29424945 0  20.27915  -.011766585  .045888 .256514  .137059 0 29.1506  9  .3333333 0     .29186290833517226 2016  9 1 300264
1    .50768805 0  20.55292  -.010779643  .286226 .157874   .26405 0 29.5004  7  .4285714 0    .045233250846826945 2017  9 2 300264
1     .6517136 0  22.84213   -.02762276  .412065 .093067  .830384 0 18.8079 11  .3636364 1    -.27703503870648605 2017 11 4 300269
1     .9951339 1 21.047047   .001748974  .361347 .099754  .563743 0  24.576  8      .375 1    -.02932054444183463 2018  9 3 300290
1     .2742808 1  23.29528   .028339105  .418399 .088991  .638635 0  30.216  9  .3333333 1    -.43179903854898427 2018  3 3 300296
1     .2742808 1  23.40386    .02292815  .467457    .156  .657006 0  30.216  9  .3333333 1     .16957717610837264 2018  3 4 300296
0     .8224062 0   22.3596    .02023436  .217166 .073752  .559094 0  30.235  9  .3333333 1  -.0013534660620244665 2017  3 2 300307
0            0 1  22.08149    .00496813  .318569 .056766  .541643 0 17.3923  9  .3333333 1     -.1093182316636897 2021  3 3 300307
1     .4153179 0  21.89628  .0033895064  .476654 .077329   .30319 0 38.3661  5        .4 0      -.255952924489975 2017  3 2 300309
0     .4354178 1 21.721395  -.003855528  .616083 .029183   .51869 0  39.027  7  .4285714 0      .4120870654860993 2020  3 1 300318
1     .8924512 1 22.820147   -.03653899   .39112 .283863  .731476 0 33.5997  7  .4285714 0                      0 2018  9 4 300324
1     .9688827 0 21.478657   .009125053  .606908 .188047  .460242 0 32.8987  9  .3333333 0    -.23475888122716715 2015  3 3 300325
0     .2641767 1 21.579025     .0047857  .407881 .145935  .227106 0 14.9629  9  .3333333 0    -.14349445349603518 2021  9 3 300348
1            1 1  21.93525   .014699864  .324316 .089403  .687769 0 34.4973  5        .6 1     -.1868557834988831 2018  3 4 300353
1     .9975692 0  20.34344  .0033247126   .37082  .24787  .099766 0 31.9707  9  .3333333 1     -.4359298809136798 2015  9 3 300359
1     .7510205 1 22.181055  -.003590918  .635557 .060432  .726369 0 22.9484  9  .3333333 0     .19539588099963678 2018  3 1 300370
0            0 1  20.60864    .04686939  .127611 .031409  .416343 0 37.9331  9  .3333333 0     .07301149201185964 2020  3 3 300371
1     .9531569 1  22.46001    .01277796  .540681 .088004  .914441 0 36.8229  7  .4285714 1     -.3845862454277057 2018  3 3 300393
1     .7913252 1  21.18667    .04640011  .069492 .184622   .25459 0 36.0951  9  .3333333 0    -.41388743559777785 2018  3 3 300401
0            0 1  21.73963   .008965104  .489268 .160369  .828905 0 19.3068  9  .3333333 0     .06756034191210492 2021  3 2 300407
1     .7682842 1 21.791153   .010304288  .291099 .052184   .41771 0 46.2262  9  .3333333 1     .12759175506489862 2018  3 1 300410
1     .6578388 0  20.74238   .008915341  .496562 .077539  .525107 0 50.4043  7  .4285714 1    -.22146099550103127 2017  3 2 300464
1            1 0 20.347645    .02697752  .236375 .434268  .448916 0 38.9245  9  .3333333 1    -.06323998653113438 2017  3 4 300551
0            0 1   20.5574    .02880557  .363753 .063769  .298195 0    25.5  7  .4285714 0     -.0662189812134778 2020  3 3 300585
1    .02404657 1 23.310616    .05775971  .321367 .294283  .204139 0 26.6215  5        .4 1    -.16951143486656328 2021  3 3 300601
1     .6835521 1  20.65046   .012912906  .464432 .113268  .572575 0 40.9625  9  .3333333 1    -.17419392850285254 2018  3 2 300626
0            0 1  26.44896  -.004844799   .74872  .00603   .97678 1  36.915  7  .5714286 0    .016799179994585245 2019  7 4 600029
0            0 1 22.811207  -.006699676  .369692 .052668 1.020818 1  42.046  9  .3333333 0     .04394692484771667 2019  3 4 600075
1     .9517987 0 23.209024   .005478035  .733685 .005285  .573807 0  33.776  5        .4 1   -.002386545290047115 2017  3 2 600086
0            0 0  25.07936   .010072837  .664418 .153373  .981794 0 11.6366 12  .4166667 0   .0016009924931208452 2016  3 2 600089
0     .4844792 1 23.418304  .0026493766  .477798 .050355 1.009477 1 34.5699  9  .3333333 0    -.11710985373436167 2019  3 3 600231
0            0 0  19.63727    .09615283  1.05717  .01428  .087851 0 26.8973  9  .3333333 1     -.0954357578120929 2016  1 3 600265
0      .435078 1 23.407543   .007702664  .422376 .093299 1.243318 0 35.6431  9  .3333333 0    -.04277806623079439 2020  3 2 600308
0     .7013075 1  22.59021   .005534092  .367749 .056651  .715872 0 13.0008  7  .4285714 1    -.16896457691719335 2019  3 3 600330
0            0 1  22.47474 -.0045258417  .644442 .026745  .749334 1 58.7509 11  .3636364 0     .26913376718756354 2021  4 3 600333
0    .47607705 1  26.77559   .007183976  .872739 .105346  .920408 0  36.227  9  .3333333 0    -.43130380600340035 2019 10 1 600340
1     .8368456 0  23.73068   -.00488284  .695089 .062832  .785328 0 53.1409  7  .4285714 1     .06560832205811717 2017  3 2 600346
1      .782302 1  25.46907   .017336557  .749887 .091365  .925156 0 29.7181  7  .4285714 1   -.055913144969207185 2018  3 3 600346
1     .3892873 1  25.76777   .024940344  .807812 .064384  .808718 0 30.0509  7  .4285714 1    -.09854391964783138 2019  3 2 600346
1     .2352311 1  25.88449    .01922463  .789315 .061894  .778829 0 30.1139  7  .4285714 1    -.04976288367640347 2019  3 4 600346
1     .1566945 1  25.97569   .018644746  .753836  .06017  .659537 0 29.8421  7  .4285714 1      .3411362550023993 2020  3 4 600346
0      .661939 1  22.47275  .0017003987  .459604 .382775  .641488 0 23.3983  6        .5 0     .04517372069716297 2019  3 4 600360
0     .3623271 0 22.173643   .009962313  .456647 .091991  .475666 0  31.338  9  .3333333 0      .2567057033430653 2016  3 3 600439
0            0 1  20.79213  -.002649176  .427094 .322445  .494864 1 36.8164 11  .3636364 0      .2649242192403183 2021  3 3 600444
0    .26726076 1 22.014925  .0014494708  .591517 .123144  .684544 1  14.258  9  .3333333 0    -.01948412810179123 2019  3 3 600448
0            0 1  23.54738   .007701847  .606597 .086585  1.01381 1 33.5524  9  .3333333 0     -.1090634709159376 2021  3 3 600480
0            0 0  23.36157   .009406263  .360812 .047724 1.084768 1 62.4298  5        .4 0    .009020793247705772 2016  2 4 600508
0     .6114326 1 24.539583    .00894955  .620814 .050155 1.079603 0  28.243  7  .4285714 1    -.04868503948826297 2020  3 4 600567
1            1 0 22.611393    .00534941  .307209 .054053  .605177 0 27.1303  9  .3333333 1     -.2985858144546044 2016  3 1 600568
0            0 0  24.14273   .023531994  .482625 .282564  .557201 1 30.5753  9 .44444445 0     .05897044167939547 2015  3 2 600600
0            0 0  23.18254   .008274175  .498252 .203234  .673632 1 44.8454  7  .4285714 0     -.4034485555690125 2016 10 3 600604
0            0 0   20.2786   .007284536  .226606 .033067  .166098 0 24.3789  9  .3333333 1       .585684180265722 2015  3 1 600615
0            0 0  21.55271   .007720045  .279857 .135833  .316044 1  30.083  9  .3333333 0     .41188393277189883 2015  3 1 600630
0            0 1  23.83587   .008585018  .580881 .123725  .871618 0 18.0711  9  .3333333 0      .2803870438421696 2020  4 2 600635
0            0 1  23.73287   .011790133  .622617 .130968  .560358 1 29.9163 11  .3636364 0   -.023191744472545572 2020  3 2 600667
0            0 1 22.621674   -.02041158 1.018136 .024767  .749401 1 16.4238  8      .375 0      .4635983027393882 2019  9 1 600701
0       .88701 1 23.681334   .005780789  .525293  .02777  .916239 0 19.1051  7  .4285714 0     .09153954367115591 2019  2 3 600711
0            0 0 20.968317   .011037055  .140066 .165021  .220093 1 29.9859  7  .4285714 0    -.12045754020625976 2016  3 3 600722
0            0 0  24.92975   .027391795  .566216 .263927  .720514 1 60.0979  9  .3333333 0     -.1345313645026236 2015  3 2 600741
0            1 1  25.51827  .0010030632  .848233 .028064 1.085041 0 20.7636  7  .4285714 0    .022286376395145302 2019  6 2 600751
0     .3318672 0   22.7944   .017172266  .454676 .041649  .813461 1 35.7794  9  .3333333 0     .07463445530653812 2016 11 2 600790
1     .9045767 1  23.69174    .02650521  .658819 .054612   .97224 0 76.9525  8      .375 0      .1405902269896886 2018  6 4 600828
0            0 1  21.87699 -.0023763196  .253003  .10045  .582373 1 34.2332  7  .4285714 0    -.33242397148868064 2021  6 1 600861
0            0 0  19.28841   -.02068241  .824874 .023951   .06985 0 19.9855  9  .3333333 1    -.22755082227285428 2015  6 2 600892
0            0 1  23.14914    .01556417  .329963 .084171  .246278 0 65.7524  8      .375 0    -.15109723645802042 2020  3 3 601689
0    .29991814 0 21.009176  .0017302285  .163564 .198732  .454089 0 60.3196  9  .3333333 0    -.24495131486580268 2016  3 3 603015
0            0 1 20.622696    .02524882  .072634 .162452  .530629 0 21.0654  9  .3333333 0    -.12825270221775242 2020  3 3 603037
0            1 0 23.293783   .006654749  .156135 .081715    .6284 0 33.2547  9  .3333333 0   -.019349734755202963 2017  3 3 603077
0            0 1 21.931345    .06706159  .161692 .180742   .15303 0 28.7483  9  .3333333 0    -.21598763472825033 2021  3 1 603267
0            0 1 22.380907    .03972865  .433639 .304337  .711804 0 33.3624  6  .3333333 1    -.09777169402567254 2020  3 4 603279
0     .5320329 1  21.50497   .007694268  .707826 .099067  .488629 0  46.771  7  .4285714 0    -.04376393424485725 2020  9 2 603322
0            0 0 21.275326    .01904242  .147341 .238606  .353355 0 33.2426  9  .3333333 0    -.13376861614579028 2016  3 4 603566
0     .7840972 0 22.652765    .02484536  .320489   .2563  .745196 0 67.8317  5        .4 1   -.016652915393096768 2017  3 4 603567
0            0 1 22.145754   .012963322  .322122 .338618   .55658 1 45.9758  9  .3333333 0     .04042580684870356 2020 12 3 603698
1     .4880457 1 21.672144   .009996806  .370607 .261186  .707591 0 40.0614  9  .3333333 1      .1635618882072225 2018  6 4 603716
0            0 1 21.388275     .0124513   .25368 .150989  .768778 0 30.5642  7  .4285714 0     .05418102223056631 2021  3 2 603767
0            0 1  22.58826    .06417773  .139437 .064182  .433112 0 53.6302  7  .4285714 0     .28280006431430627 2018  3 4 603806
0            0 1  20.63663   .006384746  .287559 .093378  .648446 0 22.4375  9  .3333333 0     .02511165821906225 2019  3 2 603829
0            0 1 22.098873   .028187815  .277828 .470317   .75357 1 59.7851 10        .4 1    -.07678590846520705 2018  9 4 603888
0     .6850176 1  21.90451   .008435733  .257466  .15916  .884423 0 31.0935  9  .3333333 0     .22406118735230907 2020  3 2 603889
end

Feature request: Transpose estout/esttab tables

Hello,

I came along the code snippet from the documentation http://repec.org/bocode/e/estout/advanced.html#advanced907 to transpose models generated by esttab or estout.

I modified the MWE slightly to account also for arbitrary numbers of displayed auxiliary statistics eg. b ci p

sysuse auto, clear

eststo model1: quietly reg price weight

eststo model2: quietly reg price weight mpg

estout model1 model2, cells(b ci p)



matrix C = r(coefs)
*eststo clear
local rnames : rownames C
local models : coleq C
local models : list uniq models

local colnames : colnames(C)
local coef_names : list uniq colnames
local no_coefs = `=wordcount("`coef_names'")'

local i 0
foreach name of local rnames {
    local ++i
    local j 0
    foreach auxname of local coef_names {
        capture matrix drop `auxname'
    }
    
    foreach model of local models {
        local ++j
        matrix tmp = C[`i', `no_coefs'*(`j'-1)+1]
        if tmp[1,1]<. {
            matrix colnames tmp = `model'            
            forvalues aux_no=1(1)`no_coefs'{
                matrix tmp[1,1] = C[`i', `no_coefs'*(`j'-1) + `aux_no']
                tokenize `coef_names'
                local aux_mat_name "``aux_no''"
                matrix `aux_mat_name' = nullmat(`aux_mat_name'), tmp
            }
        }
    }
    tokenize `coef_names'
    ereturn post `1' // first coeff
    
    
    * add aux matrices to ereturn

    eststo `name'    
    forvalues aux_no=1(1)`=`no_coefs'-1'{
        tokenize `coef_names'
        local aux_mat_name "``=`aux_no' + 1''"
        estadd matrix `aux_mat_name' = `aux_mat_name'
    }
    
}

#delim ;

estout `rnames',
cells(
    b(fmt(a2))
    ci(fmt(a2) par(( " " )))
    p(fmt(3))
);
#delim cr

(1978 Automobile Data)




--------------------------------------
                   model1       model2
                 b/ci95/p     b/ci95/p
--------------------------------------
weight           2.044063     1.746559
             1.292857,2.795268 .467736,3.025382
                 7.42e-07     .0081298
mpg                          -49.51222
                          -221.3025,122.278
                              .5673237
_cons           -6.707353     1946.069
             -2347.89,2334.475 -5226.245,9118.382
                  .995459     .5901886
--------------------------------------










added matrix:
               e(ci_l) :  1 x 2

added matrix:
               e(ci_u) :  1 x 2

added matrix:
                  e(p) :  1 x 2

added matrix:
               e(ci_l) :  1 x 1

added matrix:
               e(ci_u) :  1 x 1

added matrix:
                  e(p) :  1 x 1

added matrix:
               e(ci_l) :  1 x 2

added matrix:
               e(ci_u) :  1 x 2

added matrix:
                  e(p) :  1 x 2


---------------------------------------------------
                   weight          mpg        _cons
                 b/ci95/p     b/ci95/p     b/ci95/p
---------------------------------------------------
model1               2.04                     -6.71
              (1.29 2.80)              (-2347.9 2334.5)
                    0.000                     0.995
model2               1.75        -49.5       1946.1
              (0.47 3.03) (-221.3 122.3) (-5226.2 9118.4)
                    0.008        0.567        0.590
---------------------------------------------------

Maybe this is a starting point for a transpose option for esttab or estout?

Standalone option for TeX

Sometimes I want to create a PDF of a table on its own, apart from any document. esttab, tex page is good for these cases, but I prefer to replace \documentclass{article} with \documentclass{standalone}. When a table is the entire document, I have no need for the page number nor for a largely arbitrary paper size, and if the table is wide I like not having to rotate or resize the paper or the table to make it fit. Standalone is great for these cases.

In fact, I'm curious if there is a use case for esttab, tex page where standalone is not preferable to article. If not, and if backward compatibility were not a concern, it would make sense for page to always imply standalone.

Regardless I would like a standalone option. I don't know whether this would be in addition to page, or as a substitute for page, or as a suboption for page, etc.

is there any method to separate the interaction terms into two rows?

if our models contain interaction terms, considering the length of their name/label, the table may be too wide, especially when you output too many models once a time.

many journals display their interactive terms as a two row thing as follow:

截屏2022-11-04 11 37 20

the first term is the default result of esttab while the second term is what I want so that i can reduce the width of my table and it could fit the textwidth.

have i miss something esttab can do? or is it tricky?

Troubles with tabulating multiple results from "estpost tab"

I've been trying to use "estout" (version 3.21 from 2016) to create slightly more complicated tables of summary statistics. My main goal is to have the levels of a categorical variable running down the rows of the table, and then tabulations (within rows) of multiple other categorical variables across the columns. I've nearly got what I want, but it seems that estout is reshuffling the columns in counterintuitive ways. For example, when executing the code below, I was expecting to have the "Totals" column to always be the last in each "model" group, but sometimes it is the first. In other data sets, sometimes the "Totals" column falls somewhere in the middle of the other categories!

sysuse auto

replace headroom = 10*headroom // just for cleanliness, otherwise labels look funny

estpost tab displace rep78
est sto rep78

estpost tab displace headroom
est sto headroom

estpost tab displace foreign
est sto foreign

estout rep78 headroom foreign, cell(b) unstack label

I looked into the code and noticed that there's an equation ordering sub-routine. Maybe that's what's mussing things up? Can there be an option here to simple unstack the equations in the order observed in the source matrix?

Or maybe I'm just all wrong-headed about this. Perhaps there is a better way to achieve what I want?

Single character labels in math mode are not written to file correctly

I have a coefficient in a table called "d". I'd like to label it in LaTex math mode as "$d$", but this only seems to work if I label it as "$ d$" (note the space between opening "$" and "d".

Here is an example:

. * to verify that I've got the most recent version of estout.
. ssc install esout, replace
. * load example data, estimate toy example model, suppress initial model output
. webuse "mumps2.dta", clear
. tsset tm
. qui arfima mumps

*does not work
. esttab ., rename(d "$d$")

----------------------------
                      (1)   
                    mumps   
----------------------------
mumps                       
_cons               420.3   
                   (0.16)   
----------------------------
ARFIMA                      
$                   0.498***
                 (229.85)   
----------------------------
sigma2                      
_cons             65289.6***
                  (16.32)   
----------------------------
N                     534   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001


*works
. esttab ., rename(d "$ d$")
----------------------------
                      (1)   
                    mumps   
----------------------------
mumps                       
_cons               420.3   
                   (0.16)   
----------------------------
ARFIMA                      
$ d$                0.498***
                 (229.85)   
----------------------------
sigma2                      
_cons             65289.6***
                  (16.32)   
----------------------------
N                     534   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

I am using Stata 14.

Display warning on filetype confusion

There is a class of error that I see quite often, especially among novice Stata users. Call it "faith in the file extension". The most common manifestation I see is saving (not exporting) a graph file (i.e. a .gph) with an image extension (e.g. .png). But I see a recent Statalist user making the same error with esttab and the .xls extension. (This almost works because Excel is smart.)

Commands cannot always save users from their own actions, but some of this confusion might be reduced if a warning were displayed in the following circumstance:

  1. Command is: esttab
  2. With option: using
  3. With document format option: not specified
  4. Where filename suffix is: doc, docx, pages, odt, xls, xlsx, numbers, ods, pdf.

The message would be something like this:

doc, docx, pages, odt: "Writing a fixed-format file with extension ".$extension". You may want to write an RTF file instead."
xls, xlsx, numbers, ods: "Writing a fixed-format file with extension ".$extension". You may want to write a CSV or SCSV file instead"
pdf: "Writing a fixed-format file with extension ".pdf". You may want to write a TEX file instead."

RTF-file produced by `esttab` cannot display UTF-8 characters correctly in MS-word when using stata14 or newer version

This problem has been existing for a long time (since the update of encoding mode in stata14), and I used to avoid this problem by not using non-ASCII words in my command before.

estout.pkg is an amazing work and has been put out before UTF-8 been used in Stata. At that time, for non-ASCII users (eg. Chinese users), can output their results through esttab with non-ASCII characters because the ANSI encoding mode is flexible.

Things changed that Stata use UTF-8 encoding mode. And thank you Ben, estout.pkg has been added UTF-8 support, as you declared. but the RTF-file still cannot specify these non-ASCII characters correctly. Similar problems is available from: Stata Forum

I, as a Chinese user, have tried the unicode convertfile methods, it doesn't work for Chinese characters.
besides, I tried to use ustrto() to convert Chinese characters to old gb2312(or gb18030) encoding mode, which used in Stata13. and add these converted characters into esttab syntax. still not working.

it fails me a lot and push me to seek help from you.

P.S. non-ASCII characters like Chinese characters do display well in Stata windows, but cannot display correctly in RTF-file opened by MS-word.

A few simple code with Chinese character may help you to check if this problem fixed.

sysuse auto, clear
eststo m1: reg price length
esttab m1, title(回归结果)
* correct in Stata window

回归结果
----------------------------
                      (1)   
                    price   
----------------------------
length              57.20***
                   (4.06)   

_cons             -4584.9   
                  (-1.72)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
esttab m1 using myTable.rtf, replace title(回归结果) 

* uncorrect in RTF-file as the picture follows

截屏2022-03-23 01 29 27

Suggestion: throw a notification or warning when the user tabulates stored estimations (by default) without active estimations

In regards to Issue #8, I've been thinking about how to prevent this confusion. I suggest throwing a notification or warning when

  1. namelist is empty,
  2. there are stored estimation results,
  3. there are active estimation results, and
  4. the active estimation results are not present in the stored estimation results. I think this can be determined with e(_estimates_name) and $eststo.

The situation is

eststo: reg price weight
reg price length
esttab

The notification would be something like

You have not specified a list of estimation results to tabulate. There are both stored estimation results and unstored estimation results. The list of estimation results to tabulate will default to _all, which is the list of all stored estimation results. Specify . to tabulate active estimation results.

Keep keeps too many variables

I think there is a bug in estout for Stata 16: keep(x) keeps all variables with the prefix x

set obs 100
gen y = _n
gen x = _n
gen x_1 = _n
gen z = _n
reg y x x_1 z
estimates store m
estout m, keep(x)
-------------------------
                        m
                        b
-------------------------
x                       1
x_1                     0
-------------------------

Is that possible to use "number" to store the equation of correlation results?

For correlation tables, we usually add consecutive numbers in the first row and column, shown in the picture.
image
Can we automatically store the equation results of correlation to numbers rahther than the name of variables? I know a way to use eqlabels((1) (2) (3) (4), lhs("Variables")) to do this, however, if in this paper, we have ten variables, and that paper, we have 20 variabels, we always need to modify the texts after eqlabel, I do think the layout style is important and useful to increase our efficiency.

Thanks a ton!

sysuse auto, clear
pwcorr price headroom mpg displacement
quietly estpost corr price headroom mpg displacement, matrix
esttab ., replace b(3) unstack nonum nomtitle not noobs label compress eqlabels((1) (2) (3) (4), lhs("Variables")) nostar 

missing line when output Matrix to RTF-file using esttab

When I try to output bootstrap results stored in a matrix, the line between table head-row and content-row misses, which can display well in Stata.

// net install sgmediation2, from("https://tdmize.github.io/data/sgmediation2")  // install third-party command if you need
use "http://www.stata-press.com/data/r16/nlswork.dta",clear
glo y ln_wage 
glo x hours    
glo m race 

bootstrap r(ind_eff) , reps(20): sgmediation2 ${y}, mv(${m}) iv(${x})
cap mat drop Boot
mat Boot = [e(b)',e(ci_bc)']
mat rownames Boot = "$x -> $m -> $y" 
mat colnames Boot = "Coef Path" "95% Confidence Interval"
esttab mat(Boot), replace nomtitle // correct
---------------------------------------------------
                Coef Path 95% Confid~l 95% Confid~l
---------------------------------------------------       // this line exists
hours -> r~e    -.0003705    -.0004244    -.0002811
---------------------------------------------------

esttab mat(Boot) using ~/mytable.rtf, replace nomtitle // incorrect

截屏2022-04-11 15 07 31

However, if I input a matrix manually, esttab works well.

cap mat drop Test
mat Test = (1,2,3,4 \ 5,6,7,8)
mat rownames Test = "Row Name"
mat colnames Test = "Col Name"
esttab mat(Test), nomtitle // correct
----------------------------------------------------------------
                 Col Name     Col Name     Col Name     Col Name
---------------------------------------------------------------- // exist
Row Name                1            2            3            4
Row Name                5            6            7            8
----------------------------------------------------------------
esttab mat(Test) using ~/mytable.rtf, replace nomtitle // correct

截屏2022-04-11 15 13 39

Bug in -indicate- when same estimate is used twice

If the same estimate is shown in two separate columns, using the -indicate- option, only one column of indicators is generated.

eststo first: reg y x1
eststo second:  reg y x1 x2
estout first second , indicate(vars=x*)

(correctly) produces

 ------------------------------------
               (1)             (2)            
                y               y          
 ------------------------------------
vars            Yes             Yes                    
 ------------------------------------
N               2967           2967           
 ------------------------------------

but
estout first second second , indicate(vars=x*)
produces

 ------------------------------------------------------------
               (1)             (2)             (3)   
                y               y               y   
 ------------------------------------------------------------
vars            Yes             Yes                   
 ------------------------------------------------------------
N               2967           2967         2967
 ------------------------------------------------------------

With a missing "Yes" in the third column

(I'm using Stata 15 with and estout *! version 3.21 19aug2016)

Is that possible to make "Model number" above "sub-group name"

image

sysuse auto,clear
eststo clear
eststo:reg rep78 price mpg
eststo:reg rep78 price mpg
eststo:reg rep78 price mpg
eststo:reg rep78 price mpg
eststo:reg rep78 price mpg
eststo:reg rep78 price mpg
esttab ,mgroups("Group 1" "Group " "Group 3", pattern(1 0 1 0 1 0))  numbers("Model ") mlab(none)

Double backlashes are converted to single backslash in -estpost tabulate- equation label

Input:

sysuse auto, clear
lab def origin 0 "Type: dome\\stic" 1 "Type: fore\\ign", modify
lab def rep78 1 "Rep. rec. 1" 2 "Rep. rec. 2" 3 "Rep. rec. 3" 4 "Rep. rec. 4" 5 "Rep. rec. 5"
lab val rep78 rep78
estpost tabulate rep78 foreign
esttab, cell(colpct(fmt(2))) unstack noobs modelwidth(15) varlabels(`e(labels)') eqlabels(`e(eqlabels)')

Expected result:

------------------------------------------------------------
                         (1)                                

             Type: dome\\s~c Type: fore\\ign           Total
                      colpct          colpct          colpct
------------------------------------------------------------
Rep. rec. 1             4.17            0.00            2.90
Rep. rec. 2            16.67            0.00           11.59
Rep. rec. 3            56.25           14.29           43.48
Rep. rec. 4            18.75           42.86           26.09
Rep. rec. 5             4.17           42.86           15.94
Total                 100.00          100.00          100.00
------------------------------------------------------------

Actual result:

------------------------------------------------------------
                         (1)                                

             Type: dome\stic  Type: fore\ign           Total
                      colpct          colpct          colpct
------------------------------------------------------------
Rep. rec. 1             4.17            0.00            2.90
Rep. rec. 2            16.67            0.00           11.59
Rep. rec. 3            56.25           14.29           43.48
Rep. rec. 4            18.75           42.86           26.09
Rep. rec. 5             4.17           42.86           15.94
Total                 100.00          100.00          100.00
------------------------------------------------------------

Possible fix:

Bump version of _estpost_eqnamesandlabels and estpost_tabulate* from 8.2 to >=9.0. There might be analogous problems with subroutines other than tabulate or with _estpost_namesandlabels that would also be fixed by this bump, but I haven't checked them.

Is that possible to supress the last second line?

image
Can we supress the last second line?
Can we set font size of the first and last line to be 1.5pt or 3pt? Some papers require that the first and last line to be thicker than the middle line.
Best,
Thank you!

how to set the column of stats() terms when outputting multi-equation model?

when outputting multi-equations model, we may need to change the order of them(with unstack option), which means the equation (containing scalar in ereturn list)may not be set as the first display equation (eg. ivregress, heckman, we are interested in the second step but need put them behind the first step equations)

at that time, if we need to output the stats() terms, they default display below the first displayed equation and obviously, that’s not correct.
how can we set their column order? or at least, combine all columns of this multi-equations model?

I have tried to use the span in stats(, layout()) , but failed.

P.S. i want to output LaTeX file.
any solution can handle both tex-file and rtf-file are more attractive.

labcol2 causes incorrect @span in erepeat

Input:

sysuse auto
eststo: quietly reg price weight
estout using "example.tex", style(tex) replace drop(_cons) ///
  mgroups("mgroup", span erepeat(\cmidrule(lr){@span})) ///
  mlabels("mlabel", span erepeat(\cmidrule(lr){@span})) ///
  collabels("collabel", span erepeat(\cmidrule(lr){@span})) ///
  labcol("Qux", title("Foo" "Bar" "Baz"))
eststo clear

Expected:

            &    Foo     &mgroup      \\\cmidrule(lr){3-3}
            &    Bar     &mlabel      \\\cmidrule(lr){3-3}
            &    Baz     &collabel    \\\cmidrule(lr){3-3}
weight      &    Qux     &    2.044063\\

Actual:

            &    Foo     &mgroup      \\\cmidrule(lr){2-2}
            &    Bar     &mlabel      \\\cmidrule(lr){2-2}
            &    Baz     &collabel    \\\cmidrule(lr){2-2}
weight      &    Qux     &    2.044063\\

When compiled with…

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{lcc}
\input{example}
\end{tabular}
\end{document}

…the expected result is…
screen shot 2016-07-10 at 12 42 17 pm

…and the actual result is:
screen shot 2016-07-10 at 12 40 41 pm

Originally reported as “Issue with -@span- in -estout-” by Albert Sfredo, Statalist

estout: missing leading zeroes in default number formatting

Dear Ben,

I came across a small issue regarding the formatting of numbers whose absolute value is less than 1. The estout help file says that the default formatting for such numbers is to show a leading zero unless nolz is specified.
It doesn't work when number format is left unspecified, or when the general format is specified:

clear
set obs 10
g var = runiform()
eststo test: estpost sum var
estout test, cells(mean)
estout test, cells(mean(fmt(g)))
estout test, cells(mean(fmt(%g)))
estout test, cells(mean(fmt(%9.0g)))

Note that it works as default for esttab unless the %g format is explicitly specified.
In order to fix it, in the estout ADO file I added this bit to your vFormat program:

* For leading zeroes as default
if "`fmt'"=="%9.0g" & abs(`value') < 1 {
    local leadzero 0
    local value: di `leadzero' `fmt' `value'
    local value: di `value'
}
else local value: di `fmt' `value'
*local value: di `fmt' `value'

I inserted these lines right before you do:

local value: list retok value

It might not be the most elegant fix, but it sorts out the issue and I think it is stable.
As far as I can tell there is no need to modify the SignificantDigits program.

Very best regards,

Marc

Default unary operator and Interaction labels

Hi. Is there a way of changing the default labels assigned to unary operators (i.X) and interaction terms (i.X1##i.X2)? E.g., if I run

sysuse auto, clear
gen efficient = 1 - (mpg<23)
label var efficient "Efficient"
eststo clear
eststo: reg price i.efficient##i.foreign, r
esttab, nobaselevels label

I get

image

and I'd like to just have Efficient instead of efficient=1. Are the only options to encode the variable, as in the case of foreign? Or relabel in the esttab command using the varlabels option (which would require labeling each element)? Is there no option to just use the label of the variable and not add the =1?

Suggestion for documentation: a diagram

I still find myself getting mixed up between groups, models, equations, columns, etc. A diagram showing all the various things that can be edited by users might be the best way to convey this.

Leading numbers cause trouble in estpost tabulate

Thanks for the great package! I think I've found an issue in the way estout handles strings with leading numbers. The issue came up when I was trying to tabulate multiple string variables that take overlapping, but not identical values. Additionally, I've only had it happen when the number is at the beginning of the string, then a space, then some other characters. The issue is the same if I encode the variable first.

Do you think this is a bug?

clear all
set obs 10
generate x = string(mod(_n, 3)) + " some string"
* x has values "0 some string", "1 some string", and "2 some string"
generate y = string(mod(_n, 2)) + " some string"
* y has values "0 some string" and "1 some string"
generate z = y

estpost tabulate x
eststo tab_x
estpost tabulate y
eststo tab_y
estpost tabulate z
eststo tab_z

estout tab_y tab_x
/* Trouble with different levels:
--------------------------------------
                    tab_y        tab_x
                        b            b
--------------------------------------
0 some str~g            5             
1 some str~g            5             
Total                  10             
0                                    3
some                                 4
string                               3
1                                   10
--------------------------------------

Expected output:
--------------------------------------
                    tab_y        tab_x
                        b            b
--------------------------------------
0 some str~g            5            3
1 some str~g            5            4
2 some str~g                         3 
Total                  10           10
--------------------------------------

*/

estout tab_y tab_z
/* Totally fine with the same levels:
--------------------------------------
                    tab_y        tab_z
                        b            b
--------------------------------------
0 some str~g            5            5
1 some str~g            5            5
Total                  10           10
--------------------------------------
*/

how to use rename option for factor variables?

No matter what I set, the factor variable is not be wrapped to one row

sysuse auto,clear
gen foreign1=foreign+1
eststo clear
eststo:reg price mpg i.foreign
eststo:reg price mpg i.foreign1
esttab, rename(foreign foreign1) label nobaselevels
esttab, rename(foreign foreign1) nobaselevels

Issues with {char} directives in SMCL output

Two related issues with {char} directives in SMCL output:

  1. {char} directives can be truncated, illustrated by the first and third tables below
  2. {char} directives are treated as a multiple characters for the purpose of column alignment, illustrated by the second and fourth tables below

Example:

clear all
sysuse auto
lab var displacement "Displacement (in{char 179})"
qui reg price displacement
estout ., nobase noomit label
estout ., nobase noomit label varwidth(30)
qui reg price c.weight##i.foreign
estout ., nobase noomit label interaction(" {char 215} ")
estout ., nobase noomit label interaction(" {char 215} ") varwidth(36)

Example result:

. clear all

. sysuse auto
(1978 Automobile Data)

. lab var displacement "Displacement (in{char 179})"

. qui reg price displacement

. estout ., nobase noomit label

---------------------------------
                                .
                                b
---------------------------------
Displacement (in{c~)     15.89588
_cons                    3029.042
---------------------------------

. estout ., nobase noomit label varwidth(30)

-------------------------------------------
                                          .
                                          b
-------------------------------------------
Displacement (in³)        15.89588
_cons                              3029.042
-------------------------------------------

. qui reg price c.weight##i.foreign

. estout ., nobase noomit label interaction(" {char 215} ")

---------------------------------
                                .
                                b
---------------------------------
Weight (lbs.)            2.994814
Foreign                 -2171.597
Foreign {char..)         2.367227
_cons                   -3861.719
---------------------------------

. estout ., nobase noomit label interaction(" {char 215} ") varwidth(36)

-------------------------------------------------
                                                .
                                                b
-------------------------------------------------
Weight (lbs.)                            2.994814
Foreign                                 -2171.597
Foreign × Weight (lbs.)         2.367227
_cons                                   -3861.719
-------------------------------------------------

As an aside, you might consider making {char 215} the default interaction for SMCL output, but I wouldn't do that unless these issues were fixed.

how to set mgroup span across columns when output to rtf?

eststo clear
sysuse auto,clear
eststo:reg rep78 weight length
eststo:reg rep78 weight 
eststo:reg rep78  length
eststo:reg rep78 weight length
eststo:reg rep78 weight
eststo:reg rep78  length
esttab, mgroups("Female evaluators" "Male evaluators" "All evaluators", pattern(1 0 1 0 1 0) span)

image

How to set the label groups of models across columns? Thanks!

Is that possible to add two rows using refcat?

sysuse auto,clear
eststo clear
eststo: quietly regress price weight mpg
eststo: quietly regress price weight mpg foreign

esttab using output.rtf,refcat(_cons "{\b {\i Variables of main interests}}",nolab below) order(_cons) replace

The below is what I expected, two rows including "Controls" and "Variables of interest"
image

Looking for suggestions: how to make command easier for reghdfe users

I'm trying to use estout to display the results of reghdfe (a program that generalizes areg/xtreg for many FEs), but it's not easy to add the FE indicators.

I'm looking at the internals of ProcessIndicateGrp and ParseIndicateOpts but I can't find an easy way to hack it from the outside to allow showing yes/no for a set of fixed effects.

Have you thought about allowing fixed effects from an e(absvar) string? For instance, if e(absvar)=="firm industry#year" that means there are two sets of fixed effects. Since I wrote reghdfe I can change it and add hidden e() stuff to make it easier to you to parse it, but I don't know what would you need and if it is feasible (given that the estout internals already look quite complex)

Best,
Sergio

Windows network paths confuse esttab

When using esttab with a Windows computer using a network path, it seems to sanitize the path in a way that makes it fail.

Example:

	*Output 
		esttab balance_* using "$tabs\Main_Tables\Tab1_BaselineBalance.csv", ///
		cells(b(star fmt(%9.6f)) se(fmt(%9.6f))) order(_cons treatment) ///
		stardetach stats(Mean Sd N, fmt(%9.3g)) style(tab) varwidth(8) ///
		modelwidth(8) plain replace

where

global root "\\rschfs1x\userrs\xxxxx\Desktop\workspace\yyyyy"
global tabs "$root\SUBMITTED_V3\Output\Tables"

(and SUBMITTED_V3\Output\Tables exists)
Typical output is

. which estout
\\rschfs1x\userrs\xxxx\Desktop\workspace\yyyy/ado/plus\e\
> estout.ado
*! version 3.31  26apr2022  Ben Jann

but esttab fails with

file
    \rschfs1x\userrs\F-J\xxxxx\Desktop\workspace\yyyyy\SUBMIT
    > TED_V3\Output\Tables\Main_Tables\Tab1_BaselineBalance.csv not found)
file
    \rschfs1x\userrs\F-J\xxxxx\Desktop\workspace\yyyyy\SUBMIT
    > TED_V3\Output\Tables\Main_Tables\Tab1_BaselineBalance.csv could not be
    opened

(note the \rschfs1x instead of the \\rschfs1x). This only appears to happen with esttab, and can be avoided (on the same computer) by using global root "U:/Desktop\workspace\yyyyy" instead. However, this is not desirable, because the automatic detection of pathnames yields the network path, not the Drive-letter path (to avoid the problem means hard-coding paths all over the place).

My suspicion is that something related to the LaTeX processing of esttab is "sanitizing" the path before attempting to write it out.

Happy to help debug on a Windows computer with such network paths, if not available to you.

Option for float placement in esttab

I really enjoy using esttab for creating LaTeX tables out of Stata. However, it would be nice to be able to define the placement of a table from within the command using a designated option. So far it seems as if htbp is hardcoded into the command:

local tex_open `"`"\`=cond("\`longtable'"=="", "\begin{table}[htbp]\centering", "{")'"'"'

Could you add this as a feature?

Possible issue with precedence of stored estimation

I'm unsure what expected behavior is here:

. sysuse auto
(1978 Automobile Data)

. qui eststo: reg price weight

. qui reg price length

. esttab

----------------------------
                      (1)   
                    price   
----------------------------
weight              2.044***
                   (5.42)   

_cons              -6.707   
                  (-0.01)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. 

The user expected esttab to parse the product of reg price length.

The trouble begins when capt est_expand $eststo, and est1 is found to be present in $eststo.

See this Stata thread for background.

Remove last \\ from esttab fragment

esttab with the fragment option generates a file that ends in \\

Once this fragment is used within a longtabu environment, this causes an additional, empty line. This is because the input command has to end with \\ such as in

\begin{longtabu}{l*{2}{c}}   
\caption{My caption \label{tab:mylabel}} \\
\toprule 
\input{fragment.txt} \\
\bottomrule
\end{longtabu}

Sample output:

image

If possible, kindly remove this additional \\ from the end of the fragment.

Can't rename variable in a three-level mixed-effects model

Hi!

estout fails with an error when trying to rename a variable in a three-level mixed-effect model.

See example below from example 4 for melogit:

use http://www.stata-press.com/data/r15/towerlondon, clear
melogit dtlm difficulty i.group || family: || subject: , or
esttab, rename(difficulty "Test rename")

estout fails with the following error:

equation / not found
r(303);

The error seems to be caused by line 2622 in estout.ado.

Replacing it with

capture mat `tmp' = `bc'[`"`eq':"',1]
if _rc != 0 continue

seems to fix the issue.

Markdown support?

Hi,

I've been using your estout and esttab packages all throughout grad school, so thank you for the crazy good contribution. Alas, I've decided to go into another direction and use pandoc markdown now.

Are there any plans to support export of tables into markdown tables?

Thank you

unstack problem when output single-equation & multi-equation together

sometimes we need to combine summarize table and correlation table. so I tried code as below

sysuse auto, clear
eststo tabsum: estpost sum price mpg weight
eststo tabcor: estpost corr price mpg weight, matrix

esttab tabsum tabcor, not nomtitle noobs nonumber legend eqlabel("",none) ///
      cells((mean(pattern(1 0) fmt(3) ) ///
               sd(pattern(1 0) fmt(3) ) ///
                b(pattern(0 1) fmt(4) star) ///
))

// which gives me something like
------------------------------------------------------
                     mean           sd            b   
------------------------------------------------------
price            6165.257     2949.496       1.0000   
mpg                21.297        5.786      -0.4686***
weight           3019.459      777.194       0.5386***
mpg                                          1.0000   
weight                                      -0.8072***
weight                                       1.0000   
------------------------------------------------------

// then I add unstack to separate e(b) content

esttab tabsum tabcor, not nomtitle noobs nonumber legend eqlabel("",none) ///
      cells((mean(pattern(1 0) fmt(3) ) ///
               sd(pattern(1 0) fmt(3) ) ///
                b(pattern(0 1) fmt(4) star) ///
)) unstack

// then it gives me something as below. the correlation matrix goes missing
--------------------------------------
                     mean           sd
--------------------------------------
price            6165.257     2949.496
mpg                21.297        5.786
weight           3019.459      777.194
--------------------------------------
* p<0.05, ** p<0.01, *** p<0.001

esttab does not take care of labels with special characters

Thanks for the great work and also putting the source on github. Hopefully this becomes more common for people who write packages for Stata.
I actually have two related issues here.

Steps to reproduce the error
I have defined labels for values of a variable. I had

label define      myvar_labels          1 "Moody's"     2 "S&P's"
label values      myvar                    myvar_labels

when doing

estpost tab myvar myvar2
esttab using "table.tex", replace label cells("b pct") 

I face the following two issues:

Issue 1: Apostrophe ' in labels of values

It seems that when exporting table, esttab cannot handle an apostrophe sign ' in labels for values of variables.

I get the following error

invalid syntax
in not found
r(111)

Removing the apostrophes from the labels solved the issue but, well, it is a restriction and makes the output ugly.

Issue 2: Ampersand & in labels of values

When exporting to tex file, esttab does not escape the special characters of latex , in this case the & gets passed directly to the latex table and causes errors when compiling the tex document since it gets interpreted as alignment character. The correct behavior should be to escape it and exporting it as \&.
A quick fix is to use \& instead of & in the label.

-estout matrix()- not working in combination with option style()

Hi,

I stumbled upon an issue in estout that evolves in a scenario that, probably, is quite seldomly used:
When estout is invoked to work on a matrix (estout matrix(X)), adding the option style() to the estout call makes it abort with the error message 198 (invalid syntax), even if the specified style file contains the exact same options than a manuall call to estout.

I tried to illustrate this in a minimal example:

clear
capture : program drop estout

* create a simple matrix
matrix A = (1,2\2,1)

* create a minimal estout defaults definition file
file open deffile using "estout_matrixtest.def" , write text replace
file write deffile `"* estout_matrixtest.def: estout defaults file for -estout-"' _newline
file write deffile `"title This is my title"' _newline // <-- this is the title; all other options are copied from estout's defaults
file write deffile `"varwidth 13"' _newline
file write deffile `"modelwidth 12"' _newline
file write deffile `"abbrev abbrev"' _newline
file write deffile `"smcltags smcltags"' _newline
file write deffile `"smclrules smclrules"' _newline
file write deffile `"interaction `"" # ""'"' _newline
file close deffile

* estout the minimal matrix, with manual title option
estout matrix(A) , title("This is my title") 	// <-- this works

* estout the minimal matrix, with defaults file title option
estout matrix(A) , style(matrixtest)		// <-- this, unexpectedly, does not
exit 0
// EOF

It seems that, internally, some return values of the sub-program MatrixMode are overwritten before saved to local macros, so that at a later point the information is missing. I already tried to implement a fix for this, which might not solve the issue in the most elegant way possible, but works in my test scenario. As soon as I understood how to fork the repository, commit my change, and create a pull request from it, I will do so.

Regards
Bela

Report "< .001" when p is lower than 0.001; otherwise report actual p value

Thanks for this great package that has made my work much easier over the last years!

I am trying to reproduce an APA table. See Table 3:
https://apastyle.apa.org/style-grammar-guidelines/tables-figures/sample-tables#regression

I roughly get what I want with the following commands:

sysuse auto, clear
reg price weight length
estout, cells("b(label(Estimate)) se(label(SE)) ci(label(95% CI) par([ , ])) p")

The only thing I am missing is a way to dynamically convert a p value under 0.001 with "< .001". If the the p value is over 0.001, the actual value should be reported.

Is there a way to do this with estout?

Many thanks!

esttab: using mgroups() with matrix

I'm trying to export a LaTeX table with a custom matrix using esttab. I just wanted to confirm that the option mgroups() cannot be used with matrices.

It makes some sense, since matrix columns are not necessarily models, but would be a nice feature to add so it's easier to create custom tables.

(Big fan of your commands, btw. Thank you for developing them!)

Reproducible example

Create a mock matrix

sysuse census.dta, clear

reg death marriage pop		
matrix a = r(table)

I would expect to write something like this

esttab 	matrix(a) using "../outputs/Raw/mat-test.tex", ///
	replace ///
	mgroups("Title 1" "Title 2", ///
		pattern(1 0 1) ///
		prefix(\multicolumn{@span}{c}{) ///
		suffix(}) ///
		span erepeat(\cmidrule(lr){@span}))

mat-test.tex looks like this:

\begin{tabular}{l*{3}{c}}
\hline\hline
            &\multicolumn{3}{c}{Title 1}           \\\cmidrule(lr){2-4}
            &           a&            &            \\
            &    marriage&         pop&       \_cons\\
\hline
b           &   -.0848932&     .009489&    650.9261\\
se          &     .051956&    .0004973&    1347.445\\
t           &   -1.633945&    19.08104&    .4830819\\
pvalue      &    .1089521&    9.03e-24&    .6312804\\
ll          &   -.1894152&    .0084886&   -2059.783\\
ul          &    .0196287&    .0104895&    3361.635\\
df          &          47&          47&          47\\
crit        &    2.011741&    2.011741&    2.011741\\
eform       &           0&           0&           0\\
\hline\hline
\end{tabular}

This one creates the table I want

esttab 	matrix(a) using "../outputs/Raw/mat-works.tex", ///
	replace ///
	prehead("\begin{tabular}{l*{3}{c}}" ///
		"\hline\hline" ///
		"& \multicolumn{2}{c}{Title 1} & Title 2 \\" ///
		"\cmidrule(lr){2-3} {4-4}")

mat-works.tex looks like this:

\begin{tabular}{l*{3}{c}}
\hline\hline
& \multicolumn{2}{c}{Title 1} & Title 2 \\
\cmidrule(lr){2-3} {4-4}
            &           a&            &            \\
            &    marriage&         pop&       \_cons\\
\hline
b           &   -.0848932&     .009489&    650.9261\\
se          &     .051956&    .0004973&    1347.445\\
t           &   -1.633945&    19.08104&    .4830819\\
pvalue      &    .1089521&    9.03e-24&    .6312804\\
ll          &   -.1894152&    .0084886&   -2059.783\\
ul          &    .0196287&    .0104895&    3361.635\\
df          &          47&          47&          47\\
crit        &    2.011741&    2.011741&    2.011741\\
eform       &           0&           0&           0\\
\hline\hline
\end{tabular}

Is that possible to add an option to report one-sided tests?

Sometimes, I need to report the exact one-sided p values in the tables, I know pvalue(name) to specify the p-values used, however, calculating the one-sided p values for all coefficients seems difficult for me, could you please add such option?

Thanks so much!
Sincerely!

esttab csv onecell linebreaks

I have a simple regression model I want to export to an csv file.

In my table it is crucial the the coefficient and the SE are in the same cell. However, I'd like to also include a linebreak between them. How can I do this while still using the csv format?

sysuse auto, clear
eststo: regress price weight mpg
esttab using example, csv replace ///
onecell ///
incelldelimiter(CHAR(10))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.