1998.dta
(1.29 MB)
下面是命令:
- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input float shi_id int class_xiao long emply
- 1103 610 22
- 3001 610 235
- 300035 610 18855
- 2609 610 170
- 1704 610 140
- 3013 610 102
- 1216 610 127
- 1216 610 122
- 606 610 61529
- 1216 610 180
- 2208 610 167
- 602 610 1532
- 2211 610 180
- 2208 610 414
- 1214 610 60
- 2207 610 350
- 1207 610 1062
- 1216 610 652
- 510 610 4114
- 2208 610 743
- 2206 610 297
- 703 610 28
- 1305 610 1411
- 2407 610 390
- 1216 610 905
- 1821 610 10571
- 2201 610 270
- 1216 610 160
- 2201 610 50
- 711 610 178
- 2708 610 410
- 300030 610 300
- 300024 610 1144
- 1514 610 610
- 1406 610 4971
- 805 610 855
- 2206 610 260
- 810 610 85
- 1207 610 356
- 1216 610 102
- 2711 610 1763
- 2202 610 374
- 811 610 94715
- 1305 610 508
- 1216 610 120
- 1808 610 14
- 1206 610 190
- 1216 610 230
- 1511 610 286
- 1610 610 468
- end
- sort shi_id class_xiao
- bysort shi_id class_xiao : egen double emp_city=sum( emply )
- duplicates drop class_xiao emp_city, force
- drop emply
- order shi_id class_xiao
- total( emp_city)
- total (emply)



雷达卡





[sad] 第一步:我先直接用 total emp 计算了所有地区、所有产业的总就业量为1.09e+09;第二步:按照产业分类计算了不同地区对应的就业量( bysort shi_id : egen double emp_city=sum(emp)),再计算total emp_city为1.05e+09。按道理来说 total emp 和 total emp_city 的结果应该是相等的,但是我得到的结果却不一致,我就想问老师如何使 利用分组求和 得到的 emp_city 总就业量 和 total emp 结果一致?
京公网安备 11010802022788号







