{smcl} {* 25July2017}{...} {hi:help t2docx} {hline} {title:Title} {phang} {bf:t2docx} {hline 2} Report Mean Comparison for a lot of variables between two groups with formatted table output in DOCX file. {marker syntax}{...} {title:Syntax} {p 8 17 2} {cmdab:t2docx} {it:varlist} [{it:if}] [{it:in}] {it:using filename} {cmd:,} [{it:options}] {opth by:(varlist:groupvar)} varlist is a list of numerical variables to be tested. {pstd} {cmd:t2docx} can report a standard t-test to compare mean difference between two groups Users can also append the output from {cmd:t2docx} to other docx documents, which is more likely to be generated by {cmd:putdocx}, {cmd:reg2docx}, {cmd:sum2docx} 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 t2docx} {phang} {opt by(groupvar)} variable defining the groups {p_end} {phang} {opt diff(value1 value2)} select two values of the {it:groupvar} if {it:groupvar} has more than 2 values {p_end} {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("T-test Table"). {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 fmt(fmt)} specify the display format for group means and their difference; default format is %9.3f. {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 not} do not output t-value. {p_end} {phang} {opt p} output p-value instead of t-value. {p_end} {phang} {opt se} output standard error instead of t-value. {p_end} {phang} {opt nostar} do not output significance stars. {p_end} {phang} {opt star}{opt [}{opt (symbol level [...])}{opt ]} output significance of the coefficients. {p_end} {phang} {opt staraux} the significance stars be printed next to the t-statistics (or standard errors, etc.) instead of the coefficient. {p_end} {phang} {opt starsps} set the format of symbols to be superscript. {p_end} {phang} {opt unequal} unpaired data have unequal variances. {p_end} {phang} {opt welch} use Welch's approximation. {p_end} {marker example}{...} {title:Example} {pstd} {phang} {stata `"sysuse auto, clear"'} {p_end} {pstd} Report Mean Comparison for variables price weight length mpg between foreign group with formatted table output in DOCX file. {phang} {stata `"t2docx price weight length mpg using 1.docx, replace by(foreign)"'} {p_end} {pstd} Add table tile {phang} {stata `"t2docx price weight length mpg using 1.docx, replace by(foreign) title("this is the t-test table")"'} {p_end} {pstd} Add format for t-test table %9.2f {phang} {stata `"t2docx price weight length mpg using 1.docx, replace by(foreign) fmt(%9.2f) title("this is the t-test table") "'} {p_end} {pstd} Use the option append to append the output to an existing file {phang} {stata `"t2docx price weight length mpg turn using 1.docx, append by(foreign) fmt(%9.2f) title("this is the t-test table")"'} {p_end} {pstd} Change the significance of the coefficients and the significance stars {phang} {stata `"t2docx price weight length mpg rep78 headroom trunk using 1.docx, replace by(foreign) star(* 0.01 ** 0.005 *** 0.001) title("this is the t-test table") note("Data source: auto.dta")"'} {p_end} {pstd} Output coefficients without significance stars {phang} {stata `"t2docx price weight length mpg rep78 headroom trunk using 1.docx, replace by(foreign) nostar title("this is the t-test table")"'} {p_end} {pstd} Output table without t-value {phang} {stata `"t2docx price weight length mpg rep78 headroom trunk using 1.docx, replace by(foreign) not title("this is the t-test table")"'} {p_end} {pstd} Output table with p-value {phang} {stata `"t2docx price weight length mpg rep78 headroom trunk using 1.docx, replace by(foreign) p title("this is the t-test table")"'} {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}Zijian LI{p_end} {pstd}China Stata Club(爬虫俱乐部){p_end} {pstd}Wuhan, China{p_end} {pstd}jeremylee_41@163.com{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 sum2docx} (if installed)} {stata ssc install sum2docx} (to install){p_end} {synopt:{help corr2docx} (if installed)} {stata ssc install corr2docx} (to install){p_end} {p2colreset}{...}