reg2docx is now available on SSC, again, thanks to Kit Baum
with this command, we can report regression results directly to docx
with this command, you do not need to bother to install and set for the wordconvert command
It 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, corr2docx, t2docx and etc, either using the append or replace option.
A demonstration is as following:
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) r2(%9.3f) ar2(%9.2f) order(x6 x5) b(%9.3f) t(%7.2f) ///
title(table2: OLS regression results) mtitles("model 1" "model 2" "" "model 4")
with this command, we can report regression results directly to docx
with this command, you do not need to bother to install and set for the wordconvert command
It 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, corr2docx, t2docx and etc, either using the append or replace option.
A demonstration is as following:
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) r2(%9.3f) ar2(%9.2f) order(x6 x5) b(%9.3f) t(%7.2f) ///
title(table2: OLS regression results) mtitles("model 1" "model 2" "" "model 4")
Comment