help sum2docx

Title

sum2docx -- Report summary statistics to formatted table in DOCX file.

Syntax

sum2docx varlist [if] [in] [weight] using filename , [options]

where varlist is a list of non-string variables , or _all. The * and ? wildcards are allowed in varlist

Description

sum2docx can report all the statistics which can be reported by command summarize in detail model. You can specify those statistics in option stats(). Users can also append
the output from sum2docx to other docx documents, which is more likely to be generated by putdocx, reg2docx, t2docx and corr2docx,
either using the append option or the command can be as following:

`"putdocx append d:/mytable0.docx d:/mytable1.docx d:/mytable2.docx, saving(d:/mytable.docx,replace)"'

Options for sum2docx

replace permits to overwrite an existing file.

append[(apopts)] permits to append the output to an existing file and change style definitions along with page break, header, and footer settings.

margin(type, #[unit]) set page margins for the document.

title(string) specify the title of the table. The default is title("Summary Statistics").

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

font(fontname[, size[, color]]) sets the font, font size, and font color for the document. Note that the font size and font color may be specified individually without specifying fontname.
Use font("", size) to specify font size only. Use font("", "", color) to specify font color only. The default is font("Times New Roman").

landscape changes the document orientation from portrait to landscape.

note(string[, cell_fmt_options]) adds notes under the table.

layout(putdocx_table##layouttype:layouttype) adjust column width.

varname output variables' names in the first column of the table.

varlabel output variables' labels instead of names in the first column of the table.

stats() specifies the statistics to be output. Including N, mean[(fmt)], var[(fmt)], sd[(fmt)], skewness[(fmt)],
kurtosis[(fmt)], sum[(fmt)], sum_w[(fmt)], min[(fmt)], median[(fmt)], max[(fmt)],
p1[(fmt)], p5[(fmt)], p10[(fmt)], p25[(fmt)], p75[(fmt)], p90[(fmt)],
p95[(fmt)], p99[(fmt)]. The default format is %9.3f.

Example

`"sysuse auto, clear"'

Report summary statistics for variable mpg weight length rep78 and foreign

`"sum2docx mpg weight length rep78 foreign using d:/temp1.docx, replace stats(N mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g))"'

Add table title

`"sum2docx mpg weight length rep78 foreign using d:/temp2.docx, replace stats(N mean sd min median max) title("this is the summary statistics")"'

Add notes

auto.dta")"'

Use wild card

this is the summary statistics")"'

Use all variables

`"drop make"'

this is the summary statistics")"'

Append all files together

`"putdocx append d:/temp1.docx d:/temp2.docx d:/temp3.docx d:/temp4.docx d:/temp5.docx, saving(d:/mytable.docx,replace)"'

We can also use the option append to append the output to an existing file

`"sum2docx mpg weight length rep78 foreign using d:/mytable.docx, append stats(N mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g)) title("this is the summary statistics")"'

Author

Chuntao LI

China Stata Club(爬虫俱乐部)

Wuhan, China

chtl@zuel.edu.cn

Yuan XUE

China Stata Club(爬虫俱乐部)

Wuhan, China

xueyuan19920310@163.com

Also see

reg2docx (if installed) ssc install reg2docx (to install)

t2docx (if installed) ssc install t2docx (to install)

corr2docx (if installed) ssc install corr2docx (to install)