I am trying to estimate the Gini value along with the standard error per sub-district in a province. this is the code,
so 'KodeKec' is the code for the sub-district, 'rpcexp' is per capita expenditure, and 'weind' is weight
there are 78 sub-districts in this province, after I run this code with the output in the form of a table, there are gini_k, se_k, rse_k values for several sub-districts the values do not come out, the results are like this
for sub-district code 1,4,19,28,61,66,73,75 The value doesn't come out, why could this happen even though all the sub-district codes have been checked and there are no missing values
Code:
use "RawDataDIY.dta", clear
svyset [pweight=weind], singleunit(centered)
gen gini_k =.
gen se_k=.
egen kec = group(KodeKec)
levels kec, local(levels)
foreach i of local levels {
qui: capture svylorenz rpcexp if kec== `i'
qui: capture replace gini_k = e(gini) if kec == `i'
qui: capture replace se_k = e(se_gini) if kec == `i'
}
se more off
gen rse_k=(se_k/gini_k)*100
tabstat gini_k se_k rse_k, by(KodeKec) stat(mean)
there are 78 sub-districts in this province, after I run this code with the output in the form of a table, there are gini_k, se_k, rse_k values for several sub-districts the values do not come out, the results are like this
Code:
kec | gini_k se_k rse_k
---------+------------------------------
1 | . . .
2 | .3236615 .0409631 12.65615
3 | .3479927 .0208529 5.992333
4 | . . .
5 | .4850726 .0746428 15.38797
6 | .272455 .0343273 12.59924
7 | .4115441 .030173 7.331648
8 | .3644902 .0447773 12.28492
9 | .2005783 .0572163 28.52565
10 | .3069342 .039483 12.86366
11 | .4392424 .0368892 8.398365
12 | .3881672 .022053 5.681323
13 | .4200568 .0638027 15.18906
14 | .3091764 .0473599 15.31808
15 | .3288876 .028269 8.595346
16 | .2593643 .0284335 10.96276
17 | .2931836 .0285276 9.730268
18 | .3450475 .0479122 13.88569
19 | . . .
20 | .3720469 .059162 15.90176
21 | .3199758 .0402154 12.56828
22 | .3560917 .0568015 15.95138
23 | .2482602 .0187694 7.560367
24 | .4864481 .0533019 10.95737
25 | .3809263 .0351225 9.22028
26 | .466657 .0340591 7.298533
27 | .4493191 .0345365 7.68641
28 | . . .
29 | .3807119 .0345034 9.062861
30 | .2187588 .0633805 28.97279
31 | .2169345 .0498574 22.98272
32 | .2930791 .041907 14.29888
33 | .2822609 .0246727 8.741098
34 | .3636091 .0600133 16.50489
35 | .2778798 .0411844 14.82093
36 | .2778468 .0507827 18.27723
37 | .225424 .0390376 17.31742
38 | .2661427 .0328803 12.35437
39 | .4669875 .05516 11.81188
40 | .3066085 .0892138 29.09697
41 | .2607204 .0341451 13.09642
42 | .3174371 .0357079 11.24881
43 | .276811 .0318549 11.50782
44 | .2920399 .0445752 15.26339
45 | .160203 .0305986 19.09992
46 | .1921299 .0249694 12.99611
47 | .2760913 .0383637 13.89531
48 | .2393108 .0420418 17.56789
49 | .2303829 .0414115 17.97509
50 | .3431368 .0424198 12.36236
51 | .4138712 .0367787 8.886518
52 | .4894471 .0428221 8.749076
53 | .3442785 .0284406 8.260928
54 | .4590557 .0454393 9.898438
55 | .3163427 .0464025 14.66842
56 | .3549649 .0511322 14.40485
57 | .4566012 .047583 10.42113
58 | .3469048 .0413049 11.90669
59 | .4028805 .0358368 8.895141
60 | .3314333 .0478619 14.44088
61 | . . .
62 | .3649019 .0535948 14.68746
63 | .3272823 .0478088 14.60781
64 | .2605245 .0770205 29.56364
65 | .4425852 .0352412 7.962574
66 | . . .
67 | .4685251 .0308531 6.585158
68 | .5205715 .035366 6.793694
69 | .3967743 .0384328 9.686321
70 | .6408389 .0420558 6.562621
71 | .3831 .0433151 11.30647
72 | .5752777 .0496639 8.63303
73 | . . .
74 | .5341707 .0616662 11.54429
75 | . . .
76 | .1951421 .0537406 27.5392
77 | .3857671 .043824 11.36022
78 | .3710934 .0367112 9.892708
Code:
. tab kec, missing
group(KodeK |
ec) | Freq. Percent Cum.
------------+-----------------------------------
1 | 20 0.50 0.50
2 | 60 1.51 2.02
3 | 110 2.77 4.79
4 | 30 0.76 5.55
5 | 20 0.50 6.05
6 | 70 1.77 7.82
7 | 80 2.02 9.83
8 | 110 2.77 12.61
9 | 30 0.76 13.36
10 | 70 1.77 15.13
11 | 40 1.01 16.14
12 | 70 1.77 17.90
13 | 20 0.50 18.41
14 | 30 0.76 19.16
15 | 20 0.50 19.67
16 | 30 0.76 20.42
17 | 40 1.01 21.43
18 | 40 1.01 22.44
19 | 50 1.26 23.70
20 | 40 1.01 24.71
21 | 70 1.77 26.48
22 | 30 0.76 27.23
23 | 60 1.51 28.74
24 | 40 1.01 29.75
25 | 120 3.03 32.78
26 | 88 2.22 35.00
27 | 110 2.77 37.77
28 | 30 0.76 38.53
29 | 40 1.01 39.54
30 | 30 0.76 40.29
31 | 30 0.76 41.05
32 | 40 1.01 42.06
33 | 70 1.77 43.82
34 | 40 1.01 44.83
35 | 40 1.01 45.84
36 | 50 1.26 47.10
37 | 40 1.01 48.11
38 | 40 1.01 49.12
39 | 70 1.77 50.88
40 | 30 0.76 51.64
41 | 60 1.51 53.15
42 | 70 1.77 54.92
43 | 30 0.76 55.67
44 | 60 1.51 57.19
45 | 40 1.01 58.19
46 | 30 0.76 58.95
47 | 60 1.51 60.46
48 | 20 0.50 60.97
49 | 20 0.50 61.47
50 | 30 0.76 62.23
51 | 49 1.24 63.46
52 | 70 1.77 65.23
53 | 81 2.04 67.27
54 | 141 3.56 70.83
55 | 30 0.76 71.58
56 | 60 1.51 73.10
57 | 50 1.26 74.36
58 | 51 1.29 75.64
59 | 75 1.89 77.53
60 | 50 1.26 78.79
61 | 30 0.76 79.55
62 | 40 1.01 80.56
63 | 30 0.76 81.32
64 | 50 1.26 82.58
65 | 54 1.36 83.94
66 | 17 0.43 84.37
67 | 57 1.44 85.80
68 | 168 4.24 90.04
69 | 51 1.29 91.33
70 | 93 2.34 93.67
71 | 26 0.66 94.33
72 | 19 0.48 94.81
73 | 17 0.43 95.23
74 | 27 0.68 95.92
75 | 38 0.96 96.87
76 | 19 0.48 97.35
77 | 39 0.98 98.34
78 | 66 1.66 100.00

Comment