Reporting Empirical Results to .DOCX

实证结果输出命令新功能

薛原@爬虫俱乐部

July 8, 2022

2docx系列命令

描述性统计: sum2docx

sum2docx varlist [if] [in] [weight] using filename , [options]

相关系数矩阵: corr2docx

corr2docx varlist [if] [in] [weight] using filename , [options]

分组t检验: t2docx

t2docx varlist [if] [in] using filename , [options] by(groupvar)

回归结果: reg2docx

reg2docx modellist using filename , [options]

更新内容-共有选项

  • varname & varlabel
sysuse "auto.dta", clear
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) varname
sum2docx-varname

  • varname & varlabel
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) varlabel
sum2docx-varlabel

  • varname & varlabel
corr2docx price mpg weight length using corr.docx, replace varname
corr2docx-varname

  • varname & varlabel
corr2docx price mpg weight length using corr.docx, replace varlabel
corr2docx-varlabel

  • varname & varlabel
t2docx price mpg weight length using t.docx, replace varname by(foreign)
t2docx-varname

  • varname & varlabel
t2docx price mpg weight length using t.docx, replace varlabel by(foreign)
t2docx-varlabel

  • varname & varlabel
reg price mpg
est store m1
reg price mpg weight length
est store m2
reg2docx m1 m2 using reg.docx, replace varname
reg2docx-varname

  • varname & varlabel
reg2docx m1 m2 using reg.docx, replace varlabel
reg2docx-varlabel

更新内容-共有选项

  • note()选项

  • note(string) note(string[, cell_fmt_options])

cell fmt options

  • note()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) note("data source: 1978 automobile data")
note()

  • note()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) note("data source: 1978 automobile data", font("楷体"))
note() with font()

  • note()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) note("data source: 1978 automobile data", halign("center"))
note() with halign()

更新内容-共有选项

  • margin()选项

  • margin(type, #[unit])

margin()

  • margin()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f))
default margin()

  • margin()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) margin(all, 0.5in)
margin(all, 0.5in)

  • margin()选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) margin(top, 1in) margin(left, 0.5in) margin(right, 0.5in)
multi-margin()

更新内容-共有选项

  • append选项

  • append append(apopts)

apopts

  • append选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) font("times noew roman", 9)
sum2docx price mpg weight length using sum.docx, append stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) font("楷体", 11)
append

  • append选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) font("times noew roman", 9)
sum2docx price mpg weight length using sum.docx, append(stylesrc(own)) stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) font("楷体", 11)
append() with stylesrc()

  • append选项
sum2docx price mpg weight length using sum.docx, replace stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f))
sum2docx price mpg weight length using sum.docx, append(pagebreak) stats(N mean(%9.2f) sd(%9.2f) min(%9.2f) median(%9.2f) max(%9.2f)) landscape
append() with pagebreak

更新内容-共有选项

  • starsps
corr2docx price mpg weight length using corr.docx, replace star
corr2docx - stars

  • starsps
corr2docx price mpg weight length using corr.docx, replace star starsps
corr2docx - starsps

  • starsps
t2docx price mpg weight length using t.docx, replace by(foreign) star
t2docx - star

  • starsps
t2docx price mpg weight length using t.docx, replace by(foreign) star starsps
t2docx - starsps

  • starsps
reg2docx m1 m2 using reg.docx, replace star
reg2docx - star

  • starsps
reg2docx m1 m2 using reg.docx, replace star starsps
reg2docx - starsps

更新内容-特有选项

  • t2docx diff(value1 value2)
t2docx price mpg weight length using t.docx, replace by(rep78) diff(1 5) landscape
diff()

更新内容-特有选项

  • reg2docx ci()
reg2docx m1 m2 using reg.docx, replace ci(%9.2f)
confidence interval

更新内容-特有选项

  • reg2docx r2
reg2docx m1 m2 using reg.docx, replace scalars(N r2(%9.2f) r2_a(%9.2f))
R-squared

更新内容-特有选项

reg2docx addfe()

  • xtreg, fe
  • reghdfe, absorb()

webuse nlswork
xtset idcode year
xtreg ln_w age c.age#c.age i.year, fe
est store m1
xtreg ln_w age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp i.year, fe
est store m2
reg2docx m1 m2 using reg.docx, replace scalars(N r2(%9.2f)) indicate("Year FE = *year*") addfe("Individual FE = Yes")
apopts

用Stata输出一整篇论文

  • putdocx + sum2docx + corr2docx + t2docx + reg2docx
  • data source: mus08psidextract.dta from the Chapter 8 of Microeconometrics Using Stata, Revised Edition

谢谢

爬虫俱乐部公众号