*! version 1.03 2022-05-05

help for table1_mc_dta2docx

Title

table1_mc_dta2docx -- Generate Office Open XML (.docx) file containing output from table1_mc, clear

Syntax

table1_mc_dta2docx using filename [, options]

pagesize(psize) sets the page size of the document. psize may be
letter, legal, A3, A4, or B4JIS. The default is
pagesize(letter).

landscape changes the document orientation from portrait to landscape

font(fspec) general font, default is font("Calibri", 11)

datafont(fspec) font for data rows in main table, default is datafont("Calibri", 10)

datahalign(hvalue) set horizontal alignment for data columns in main table (excludes any variable called level or with prefix pvalue).
The default is datahalign(center).

tablenumber(string) specify e.g. tablenumber("Table 1.") to make a "Table 1." title appear (in bold)

tabletitle(string) specify e.g. tabletitle("Baseline characteristics by group.") to make a title appear (not in bold)

footnote(string) add a footnote after the main table and after footnote from table1_mc is reported

finside move footnote(s) inside the main table (as an additional row(s))

tabopts(table_options) options for main table (other than layout and border)

replace specifies to overwrite filename, if it exists

append specifies to append the contents of the document in memory to the end of filename. (Cannot be used with the replace option.)

Description

table1_mc_dta2docx makes use of the putdocx command introduced in Stata 15.
table1_mc_dta2docx is used after table1_mc has been used with the clear option.

The main table will consist of all variables without the prefix N_, m_, or _column.
You might like to delete the (unfortunate) blank line between the table and the footnote(s).
Or use the option finside.
Using the option finside, footnote() is equivalent to tabopts(note()).

The table showing the number of records used, and not used, in calculating summary statistics
will consist of the variable called factor and all variables with the prefix N_ or m_.
If there are no variables with the prefix N_ or m_, this table won't appear.

Examples [Stata 15.1 or later required]

. sysuse auto, clear

. table1_mc, by(foreign) vars(price conts \ weight contn %5.0f \ rep78 cate) extraspace clear

Did the above command use the clear option? Yes! Then we are now ready to:

. cd "H:\" (or whichever directory you want to save to)

. `"table1_mc_dta2docx using "example Table 1.docx", replace"'

To prevent a pvalue column appearing in the main table in the coming .docx file:

. drop pvalue

To only report - #records not used - after the main table in the coming .docx file:

. drop N_*

Or, to report only the main table in the coming .docx file:

. drop N_* m_*

. cd "H:\" (or whichever directory you want to save to)

. `"table1_mc_dta2docx using "example Table 1.docx", replace tablenumber("Table 1.") tabletitle("Car characteristics by car type.") footnote("Foreign cars included Audi, Datsun, Toyota and VW cars.")"'

Author

Mark Chatfield, The University of Queensland, Australia.

m.chatfield@uq.edu.au