stata - 你能划分两个表的条目吗?
问题描述
我在 Stata 中有 2 个表格:一个显示每个州在特定离婚年份队列中离婚的父母总数,另一个显示csphycus == 2
每个州和离婚年份队列中离婚父母的数量。
csphycus ==2
我想要一个表格,显示每个州和每个离婚年份队列的父母百分比。所以我想划分这两个表中的计数。我该怎么做?
解决方案
你的意思是
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)
推荐阅读
- python - 无法在 pywikibot 中运行任何脚本
- r - 在 R 中,devtools::install("path/to/directory") 安装哪个分支?
- swift - 你如何解决“不能在不可变值上使用变异成员:'self'是不可变的”?
- .net - Visual Studio Professional 2019 无法启动
- html - Angular:无法使用 *ngFor 显示来自 HTTP 响应的内容
- bixby - 如何对话模板单击在bixby中输入另一个值
- html - 向“复选框”输入类型添加溢出滚动条
- pyqt5 - PyQt5 - 获取 QWidget 内的像素颜色
- python - How to iterate over a python dictionary, setting the key of the dictionary as another dictionary's value
- python - pyspark dataframe: remove duplicates in an array column