关于第一个问题,您需要指定选项
par
在里面
sd
在内部
cells()
:
sysuse auto, clear
eststo clear
eststo Dom: estpost sum rep78 mpg turn trunk weight length if foreign==0
eststo For: estpost sum rep78 mpg turn trunk weight length if foreign==1
esttab Dom For, cells("mean(fmt(2))" "sd(par)") ///
nonumber nodepvars noobs se collabels(none) mlabels(, lhs("Var") title)
eststo clear
eststo Dom: estpost sum rep78 mpg turn if foreign==0
eststo For: estpost sum rep78 mpg turn if foreign==1
esttab Dom For using output.txt, cells("mean(fmt(2))" "sd(par)") ///
nonumber nodepvars noobs collabels(none) mlabels(, lhs("Vars") title) ///
posthead("@hline" "Variable Group 1:" "@hline" ) postfoot(" ") replace
eststo clear
eststo Dom: estpost sum trunk weight length if foreign==0
eststo For: estpost sum trunk weight length if foreign==1
esttab Dom For using output.txt, cells("mean(fmt(2))" "sd(par)") ///
nonumber nodepvars noobs collabels(none) mlabels(none) ///
prehead("@hline" "Variable Group 2:") append
这将产生所需的输出:
type output.txt
--------------------------------------
Vars Dom For
--------------------------------------
Variable Group 1:
--------------------------------------
rep78 3.02 4.29
(0.84) (0.72)
mpg 19.83 24.77
(4.74) (6.61)
turn 41.44 35.41
(3.97) (1.50)
--------------------------------------
Variable Group 2:
--------------------------------------
trunk 14.75 11.41
(4.31) (3.22)
weight 3317.12 2315.91
(695.36) (433.00)
length 196.13 168.55
(20.05) (13.68)
--------------------------------------