你能把两个表的条目分开吗?

问题描述 投票:0回答:1

我在Stata中有两张表:一张显示了每个州在特定的离婚年份组群中离婚的父母总数,另一张显示了离婚父母的数量,其中包括 csphycus == 2 在每个州和离婚年份的队列。

我想要一个表格,显示父母有以下情况的百分比 csphycus ==2 每一个州和每一个离婚年份的队列.所以,我想把这两张表的计数分开。我应该怎么做呢?

stata percentage tabulate
1个回答
0
投票

您的平均值是

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) 
© www.soinside.com 2019 - 2024. All rights reserved.