{smcl} {* 12July2017}{...} {hi:help sum2docx} {hline} {title:Title} {phang} {bf:sum2docx} {hline 2} Report summary statistics to formatted table in DOCX file. {marker syntax}{...} {title:Syntax} {p 8 17 2} {cmdab:sum2docx} {it:varlist} [{it:if}] [{it:in}] [{it:weight}] {it:using filename} {cmd:,} [{it:options}] where varlist is a list of non-string variables , or _all. The * and ? wildcards are allowed in varlist {marker description}{...} {title:Description} {pstd} {cmd:sum2docx} can report all the statistics which can be reported by command {cmd:summarize} in detail model. You can specify those statistics in option {opt stats()}. Users can also append the output from {cmd:sum2docx} to other docx documents, which is more likely to be generated by {cmd:putdocx}, {cmd:reg2docx}, {cmd:t2docx} and {cmd:corr2docx}, either using the {it:append} option or the command can be as following: {p_end} {phang} {stata `"putdocx append d:/mytable0.docx d:/mytable1.docx d:/mytable2.docx, saving(d:/mytable.docx,replace)"'} {p_end} {marker options}{...} {title:Options for sum2docx} {phang} {opt replace} permits to overwrite an existing file. {p_end} {phang} {cmd:append[(}{help putdocx_begin##apopts:{it:apopts}}{cmd:)]} permits to append the output to an existing file and change style definitions along with page break, header, and footer settings. {p_end} {phang} {cmd:margin(}{help putdocx_begin##type:{it:type}}{cmd:, #[}{help putdocx_begin##unit:{it:unit}}{cmd:])} set page margins for the document. {p_end} {phang} {opt title(string)} specify the title of the table. The default is title("Summary Statistics"). {p_end} {phang} {opt pagesize(psize)} sets the page size of the document. {it:psize} may be letter, legal, A3, A4, or B4JIS. The default is pagesize(A4). {p_end} {phang} {opt 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"). {p_end} {phang} {opt landscape} changes the document orientation from portrait to landscape. {p_end} {phang} {cmd:note(}{it:string}[{cmd:,} {help putdocx_table##cellfmtopts:{it:cell_fmt_options}}]{cmd:)} adds notes under the table. {p_end} {phang} {opth layout:(putdocx_table##layouttype:layouttype)} adjust column width. {p_end} {phang} {opt varname} output variables' names in the first column of the table. {p_end} {phang} {opt varlabel} output variables' labels instead of names in the first column of the table. {p_end} {phang} {opt stats()} specifies the statistics to be output. Including N, {opt mean}{opt [}{opt (fmt)}{opt ]}, {opt var}{opt [}{opt (fmt)}{opt ]}, {opt sd}{opt [}{opt (fmt)}{opt ]}, {opt skewness}{opt [}{opt (fmt)}{opt ]}, {opt kurtosis}{opt [}{opt (fmt)}{opt ]}, {opt sum}{opt [}{opt (fmt)}{opt ]}, {opt sum_w}{opt [}{opt (fmt)}{opt ]}, {opt min}{opt [}{opt (fmt)}{opt ]}, {opt median}{opt [}{opt (fmt)}{opt ]}, {opt max}{opt [}{opt (fmt)}{opt ]}, {opt p1}{opt [}{opt (fmt)}{opt ]}, {opt p5}{opt [}{opt (fmt)}{opt ]}, {opt p10}{opt [}{opt (fmt)}{opt ]}, {opt p25}{opt [}{opt (fmt)}{opt ]}, {opt p75}{opt [}{opt (fmt)}{opt ]}, {opt p90}{opt [}{opt (fmt)}{opt ]}, {opt p95}{opt [}{opt (fmt)}{opt ]}, {opt p99}{opt [}{opt (fmt)}{opt ]}. The default format is %9.3f. {p_end} {marker example}{...} {title:Example} {pstd} {phang} {stata `"sysuse auto, clear"'} {p_end} {pstd} Report summary statistics for variable mpg weight length rep78 and foreign {phang} {stata `"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))"'} {p_end} {pstd} Add table title {phang} {stata `"sum2docx mpg weight length rep78 foreign using d:/temp2.docx, replace stats(N mean sd min median max) title("this is the summary statistics")"'} {p_end} {pstd} Add notes {phang} {stata `"sum2docx mpg weight length rep78 foreign using d:/temp3.docx, replace stats(N mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g)) title("this is the summary statistics") note("Data source: auto.dta")"'} {p_end} {pstd} Use wild card {phang} {stata `"sum2docx *n* m?g using d:/temp4.docx, replace stats(N mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g)) title("Table 1: this is the summary statistics")"'} {p_end} {pstd} Use all variables {phang} {stata `"drop make"'} {p_end} {phang} {stata `"sum2docx _all using d:/temp5.docx, replace stats(N mean(%9.2f) sd min(%9.0g) median(%9.0g) max(%9.0g)) title("Table 1: this is the summary statistics")"'} {p_end} {pstd} Append all files together {phang} {stata `"putdocx append d:/temp1.docx d:/temp2.docx d:/temp3.docx d:/temp4.docx d:/temp5.docx, saving(d:/mytable.docx,replace)"'} {p_end} {pstd} We can also use the option append to append the output to an existing file {phang} {stata `"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")"'} {p_end} {title:Author} {pstd}Chuntao LI{p_end} {pstd}China Stata Club(爬虫俱乐部){p_end} {pstd}Wuhan, China{p_end} {pstd}chtl@zuel.edu.cn{p_end} {pstd}Yuan XUE{p_end} {pstd}China Stata Club(爬虫俱乐部){p_end} {pstd}Wuhan, China{p_end} {pstd}xueyuan19920310@163.com{p_end} {title:Also see} {synoptset 30 }{...} {synopt:{help reg2docx} (if installed)} {stata ssc install reg2docx} (to install){p_end} {synopt:{help t2docx} (if installed)} {stata ssc install t2docx} (to install){p_end} {synopt:{help corr2docx} (if installed)} {stata ssc install corr2docx} (to install){p_end} {p2colreset}{...}