使用 -esttab- 控制导出的 tex 文件中的列数
controlling the number of columns in the exported tex file using -esttab-
我正在尝试在 Latex 中导出 table 摘要统计信息,但是当我使用 table 编译 pdf 时,列数不等于摘要统计信息的数量( +1 相对于变量的第一列)。
举个例子,考虑这个:
use auto, clear
eststo: estpost tabstat weight price mpg rep78, ///
column(statistics) statistics(count mean median sd)
esttab using "auto.tex", replace ///
cells(( count(label("Observations")) ///
mean(label("Mean")) p50(label("Median")) ///
sd(label("Standard deviation")) ))
如果我手动更改 auto.tex
以便:
\begin{tabular}{l*{1}{ccccc}}
而不是 \begin{tabular}{l*{1}{c}}
,则 table 会正确显示。
我在这里缺少哪个选项?或者,有没有办法直接指定列数?
谢谢,
S
问题不在于选择正确的选项。如果 cell()
的内容是字符,则最终的 table 会正确显示,因此以下代码有效:
clear all
use auto, clear
eststo: estpost tabstat weight price mpg rep78, ///
column(statistics) statistics(count mean median sd)
esttab using "C:\Users\Stefano\desktop\esttab tex\auto.tex", replace ///
cells( "count(label(Observations)) mean(label(Mean)) p50(label(Median)) sd(label(Standarddeviation))" ) ///
booktabs noobs nomtitles nonum
请注意,如果未使用引号(如在初始代码中),Stata 不会 return 错误。有关此原因的信息,请参阅@Roberto 的回答和更一般的文档。希望这有帮助。
补充@Stezzo给出的答案:
是否使用引号会影响 esttab
显示结果的方式。如果没有引号,则会显示堆叠结果。通过引用,给出了并排的演示文稿。下面是一个例子。
clear
set more off
sysuse auto
quietly regress price weight
esttab, cells(b t)
esttab, cells("b t")
因此,应该不会出现错误。这是预期的行为。
回想一下,esttab
是 estout
的包装器,前者可以从后者获取选项。 cells()
是 help estout
中记录的一个选项。文档解释了这两种安排。
我正在尝试在 Latex 中导出 table 摘要统计信息,但是当我使用 table 编译 pdf 时,列数不等于摘要统计信息的数量( +1 相对于变量的第一列)。
举个例子,考虑这个:
use auto, clear
eststo: estpost tabstat weight price mpg rep78, ///
column(statistics) statistics(count mean median sd)
esttab using "auto.tex", replace ///
cells(( count(label("Observations")) ///
mean(label("Mean")) p50(label("Median")) ///
sd(label("Standard deviation")) ))
如果我手动更改 auto.tex
以便:
\begin{tabular}{l*{1}{ccccc}}
而不是 \begin{tabular}{l*{1}{c}}
,则 table 会正确显示。
我在这里缺少哪个选项?或者,有没有办法直接指定列数?
谢谢, S
问题不在于选择正确的选项。如果 cell()
的内容是字符,则最终的 table 会正确显示,因此以下代码有效:
clear all
use auto, clear
eststo: estpost tabstat weight price mpg rep78, ///
column(statistics) statistics(count mean median sd)
esttab using "C:\Users\Stefano\desktop\esttab tex\auto.tex", replace ///
cells( "count(label(Observations)) mean(label(Mean)) p50(label(Median)) sd(label(Standarddeviation))" ) ///
booktabs noobs nomtitles nonum
请注意,如果未使用引号(如在初始代码中),Stata 不会 return 错误。有关此原因的信息,请参阅@Roberto 的回答和更一般的文档。希望这有帮助。
补充@Stezzo给出的答案:
是否使用引号会影响 esttab
显示结果的方式。如果没有引号,则会显示堆叠结果。通过引用,给出了并排的演示文稿。下面是一个例子。
clear
set more off
sysuse auto
quietly regress price weight
esttab, cells(b t)
esttab, cells("b t")
因此,应该不会出现错误。这是预期的行为。
回想一下,esttab
是 estout
的包装器,前者可以从后者获取选项。 cells()
是 help estout
中记录的一个选项。文档解释了这两种安排。