【问题标题】:Stata esttab twoway tabulate labelsStata esttab 双向制表标签
【发布时间】:2015-12-15 18:23:54
【问题描述】:

假设我有这个数据集:

webuse union, clear

我要进行制表:

tab union smsa

我想将它导出到一个 .tex 文件并让它看起来类似于上面的表格。有没有办法让类似于下面的代码自动显示标签(union workerlives in SMSA),而不必硬编码?

eststo clear
eststo: estpost tab union smsa
esttab est1 using "${path}/example.tex", cell(b) unstack noobs ///
    replace nonum collabels(none) eqlabels(, lhs("union worker")) ///
    mtitles("lives in SMSA")

【问题讨论】:

  • sysuse auto 更正为webuse union

标签: latex stata labels


【解决方案1】:

您能澄清一下“自动”是什么意思吗?我无法对此进行测试,因为加载时这些变量不在自动数据集中,但您可以显式调用变量标签宏而不是变量标签:

eststo clear
eststo: estpost tab union smsa
esttab est1 using "${path}/example.tex", cell(b) unstack noobs ///
    replace nonum collabels(none) eqlabels(, lhs("`:variable label union'")) ///
    mtitles("`:variable label smsa'")

请尝试help extended_fcn 了解详情。

【讨论】:

  • @bill999 写了sysuse auto,但他的例子跟在webuse union之后。
  • @atkat12 通过“自动”,我的意思是我不必自己编写或引用您的解决方案中的变量标签。我想消除错误切换变量的可能性。当您使用tab var_a var_b 时,标签会自动显示在正确的位置,而无需用户指定任何内容。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-20
  • 2023-04-02
相关资源
最近更新 更多