【问题标题】:Can you divide the entries of two tables?你能划分两个表的条​​目吗?
【发布时间】:2020-06-02 04:43:54
【问题描述】:

我在 Stata 中有 2 个表格:一个显示每个州在特定离婚年份队列中离婚的父母总数,另一个显示每个州和离婚年份队列中具有csphycus == 2 的离婚父母的数量.

我想要一个表格,显示每个州和每个离婚年份队列中拥有csphycus ==2 的父母的百分比。 所以我想划分这两个表中的计数。我该怎么做?

【问题讨论】:

  • 您链接到的图像未显示。一般来说,阅读 Stata 标签 wiki 以了解发布人们可以使用的数据示例并展示您尝试过的代码。

标签: stata percentage tabulate


【解决方案1】:

你的意思是

egen double numer = total(rdasecwt * (csphycus == 2)), by(statefip yrdivbin) 
egen double denom = total(rdasecwt), by(statefip yrdivbin) 
gen wanted = 100 * numer/denom 

你可以通过一些变化来展示它

tabdisp statefip yrdivbin, c(wanted) format(%2.1f) 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-25
    • 1970-01-01
    • 2018-05-11
    • 1970-01-01
    • 1970-01-01
    • 2017-05-15
    相关资源
    最近更新 更多