help corr2docx

Title

corr2docx -- Report Pearson&Spearman coefficient of correlation to formatted table in DOCX file.

Syntax

corr2docx 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

corr2docx can report coefficient of correlation which can be reported in detail model. Users can also append the output from corr2docx to other docx documents,
which is more likely to be generated by putdocx,
reg2docx, sum2docx and t2docx, 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 corr2docx

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.

fmt(fmt) specify the display format of the coefficient of correlation. The defulat is %9.3f.

title(string) specify the title of the table. The default is title("Correlation Coefficient").

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.

star[(symbol level [...])] must specify the significance level of the coefficient of correlation from higher to lower.By defulat,it's *** p<0.01, ** p<0.05, * p<0.1

starsps set the format of symbols to be superscript.

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

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

nodiagonal do not add number 1 to the main diagonal of correlation matrix.

pearson(string) the followings can be specified in this option:

pw display all pairwise correlation coefficients.

bonferroni use Bonferroni-adjusted significance level.

sidak use Sidak-adjusted significance level.

ignore do not report pearson correlation coefficients.

spearman(string) the followings can be specified in this option:

pw calculate all pairwise correlation coefficients by using all available data.

bonferroni use Bonferroni-adjusted significance level.

sidak use Sidak-adjusted significance level.

ignore do not report spearman correlation coefficients.

Example

`"sysuse auto, clear"'

Report Pearson&Spearman coefficient of correlation for variable mpg weight length rep78 and foreign

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace"'

`"corr2docx mpg weight length rep78 if foreign == 1 using d:/temp1.docx, replace note("foreign car")"'

Add significance of the coefficient of correlation

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star"'

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, append star(* 0.05 ** 0.01)"'

Add the table title

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star note(Noting about what you want to) title("this is the coefficient of correlation")"'

Do not add number 1 to the main diagonal of correlation matrix

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star nodiagonal"'

Display all pairwise correlation coefficients in pearson correlation coefficients and do not report spearman correlation coefficients

`"corr2docx mpg weight length rep78 foreign using d:/temp1.docx, replace star pearson(pw) spearman(ignore)"'

Author

Chuntao LI

China Stata Club(爬虫俱乐部)

Wuhan, China

chtl@zuel.edu.cn

Zhengxuan ZHAO

China Stata Club(爬虫俱乐部)

Wuhan, China

Zhengxuan_ZHAO@foxmail.com

Haitao SI

China Stata Club(爬虫俱乐部)

Wuhan, China

sht_finance@foxmail.com

Updated by

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)

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