【问题标题】:How to produce summary statistics in Stata如何在Stata中生成汇总统计信息
【发布时间】:2015-10-19 16:30:13
【问题描述】:

我正在尝试为从事一项工作、从事另一项工作的人创建有关某些变量的汇总统计数据,然后将其与不从事这两种工作的人进行比较。我能够为从事任何一项工作的人获取摘要代码,但我不确定如何创建不包括这些工作的摘要。这是我目前所拥有的:

tabstat lwage educ hours exper, by(construc) stat(mean sd min max) nototal

tabstat lwage educ hours exper, by(agric) stat(mean sd min max) nototal

我认为有一种方法可以简单地通过 construc 和 agric 来汇总变量,但这不起作用。任何帮助都会很棒!

【问题讨论】:

  • 您可以使用 if 语句,例如 tabstat lwage educ hours exper if construc == 0 & agric == 0, stat(mean sd min max) nototal

标签: stata summary


【解决方案1】:

正如 Harre 在 cmets 中所说,解决方案是:

tabstat lwage educ hours exper if construc == 0 & agric == 0, stat(mean sd min max) nototal

我最初尝试 if 语句时语法错误

【讨论】:

  • 或者,您可以使用gen 和replace if 构造一个三类变量并使用by()。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-08-03
  • 2019-08-18
  • 2015-09-22
  • 1970-01-01
  • 1970-01-01
  • 2019-03-19
  • 2012-01-07
相关资源
最近更新 更多