help reg2docx

Title

reg2docx -- Report regression results to formatted table in DOCX file.

Syntax

reg2docx modellist using filename , [options]

Description

reg2docx is used after est store. Users can estimate different regression models. After that they can save the regression results with est store command.
Then, users can call reg2docx to design a formatted table output for all the saved models to a docx file.
The docx file can be appended to other docx files generated by putdocx, sum2docx, 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 reg2docx

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("Regression Table").

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.

b(string) specify format for coefficient.

t[(fmt)] output t-statistics and specify the format.

z[(fmt)] output z-statistics and specify the format.

p[(fmt)] output p-values and specify the format.

se[(fmt)] output standard error and specify the format.

ci[(fmt)] output confidence interval and specify the format.

scalars(scalarlist) specify the scalars to be output. Including all the scalars you can get in ereturn list after a regression command. The format of the scalar is defined in parentheses after the scalar.(e.g. r2(%9.2f), %9.3f by default)

noconstant do not output intercept.

constant output intercept.

noobs do not output the number of observations.

nostar do not output significance stars.

star[(symbol level [...])] output significance of the coefficients.

staraux the significance stars be printed next to the t-statistics (or standard errors, etc.) instead of the coefficient.

starsps set the format of symbols to be superscript.

mtitles(titlelist) specift model's title in the table header.

nomtitle suppresses printing of model titles.

depvar prints the name of the dependent variable of a model as the model's title in the table header.

order(list) change order of coefficients.

indicate(groups) indicate presence of parameters.

addfe(groups) specifies user-added text about the presence of fixed effects.

drop(droplist) drop individual coefficients.

keep(keeplist) keep individual coefficients.

noparentheses do not print parentheses around t-statistics.

parentheses print parentheses around t-statistics.

brackets use brackets instead of parentheses.

Example

`"clear"'

`"set obs 1000"'

`"gen x1 = uniform()"'

`"gen x2 = uniform()"'

`"gen x3 = uniform()"'

`"gen x4 = uniform()"'

`"gen x5 = uniform()"'

`"gen x6 = uniform()"'

`"gen ind = mod(_n,10)"'

`"tab ind, gen(ind)"'

`"gen y = 0.4+.5*x1+.6*x2+.7*x3+.8*x4+rnormal()*3"'

`"replace y = y-.7*x5-.8*x6"'

`"forvalue i = 1(1)10 {"'

`" replace y = y+sqrt(`i')*ind`i'"'

`"}"'

`"reg y x1 x5 x6 ind2-ind10"'

`"est store m1"'

`"reg y x1 x2 x5 x6 ind2-ind10"'

`"est store m2"'

`"reg y x1 x2 x3 x5 x6 ind2-ind10"'

`"est store m3"'

`"reg y x1 x2 x3 x4 x5 x6 ind2-ind10"'

`"est store m4"'

`"reg2docx m1 m2 m3 m4 using d:/mytable2.docx, replace indicate("ind=ind*") drop(x2 x3) scalars(N r2(%9.3f) r2_a(%9.2f)) order(x6 x5) b(%9.3f) t(%7.2f) title(table1: OLS regression results) mtitles("model 1" "model 2" "" "model 4")"'

`"reg2docx m1 m2 m3 m4 using d:/mytable2.docx, append newsection keep(x1 x4 x5 x6) addfe("ind = Yes") scalars(N r2(%9.3f)) order(x6 x5) b(%9.3f) t(%7.2f) title(table2: OLS regression results) mtitles("model 1" "model 2" "" "model 4")"'

Author

Chuntao LI

China Stata Club(爬虫俱乐部)

Wuhan, China

chtl@zuel.edu.cn

Yuan XUE

China Stata Club(爬虫俱乐部)

Wuhan, China

xueyuan19920310@163.com

Also see

sum2docx (if installed) ssc install sum2docx (to install)

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

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