如何在stata中进行1⼀4,3⼀4中位数分组

2025-04-04 20:09:28
推荐回答(1个)
回答1:

gen deduc=1 if educ<10

replace deduc =2 if educ>=10 & educ<=12

replace deduc =3 if educ>=13 & educ<=16

replace deduc =4 if educ>16

如果只是求educ 的平均值,

bys deduc : egen ave=mean(educ)

或者

tabulate deduc , summarize(educ)