Hi All,

I am using Stata 16 and trying to decompose the concentration index but the results show nothing for percentage contribution. My dependent variable is a binary variable, obese or not obese. My dependent variables are quintile , feedingscheme (whether a student participates in school feeding program or not), adorace(ado for adolescent, African/White/Coloured/Asian), adogender(male/female), employ_m (whether mother is employed), educ_m and wgt_m.

The commands are as follows: using Erreygers

Code:
sca CI=r(CI)
global X  quintile feedingscheme adorace adogender empl_m educ_m wgt_m
qui sum obese [aw=wt]
sca m_obese=r(mean)
qui glm obese $X [aw=wt], family(binomial) link(logit)
qui margins , dydx(*) post

foreach x of varlist $X {
sca b_`x'=_b[`x']
}
foreach x of varlist $X {
qui{
conindex `x' [aw=wt], rankvar(quintile) truezero
sca CI_`x' = r(CI)
sum `x' [aw=wt]
sca m_`x'=r(mean)
sca elas_`x' = b_`x'*m_`x'
sca con_`x' = 4*elas_`x'*CI_`x'
sca prcnt_`x' = (con_`x'/CI)*100
}
di "`x' elasticity:", elas_`x'
di "`x' concentration index:", CI_`x'
di "`x' contribution:", con_`x'
di "`x' percentage contribution:", prcnt_`x'
}
matrix Aaa = nullmat(Aaa) \ (elas_`x', CI_`x', con_`x', prcnt_`x')
}
matrix rownames Caa= $X
matrix colnames Caa = "Elasticity""CI""Absolute""%"
matrix list Caa, format(%8.4f)
clear matrix
The results show just a fullstop next to each variable percentage contribution. And it also gives an error message "elas_ not found". I have defined elasticity

quintile elasticity: .02855949
quintile concentration index: .26154029
quintile contribution: .02987783
quintile percentage contribution: .
feedingscheme elasticity: .03727037
feedingscheme concentration index: .05987572
feedingscheme contribution: .00892636
feedingscheme percentage contribution: .
adorace elasticity: -.01348892
adorace concentration index: .01036392
adorace contribution: -.00055919
adorace percentage contribution: .
adogender elasticity: .02694672
adogender concentration index: -.00403962
adogender contribution: -.00043542
adogender percentage contribution: .
empl_m elasticity: .01834728
empl_m concentration index: .06688754
empl_m contribution: .00490882
empl_m percentage contribution: .
educ_m elasticity: .02113921
educ_m concentration index: .08112557
educ_m contribution: .00685972
educ_m percentage contribution: .
wgt_m elasticity: .15021019
wgt_m concentration index: .01183257
wgt_m contribution: .00710949
wgt_m percentage contribution: .

. matrix Aaa = nullmat(Aaa) \ (elas_`x', CI_`x', con_`x', prcnt_`x')
elas_ not found
r(111);

My dataex results are as follows:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte quintile float(feedingscheme adorace adogender empl_m educ_m wgt_m)
. . . . . . .
. . . . . . .
. . . . . . .
. . . . 1 1 2
1 1 2 2 1 1 2
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . 1 1 2
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . 2 1 3
. . . . 2 1 3
. . . . 2 1 3
. . . . . . .
2 2 2 2 2 1 3
. . . . 2 1 3
. . . . . . .
. . . . . . .
. . . . . . .
3 1 2 2 . . .
3 1 2 1 . . .
. . . . . . .
. . . . . . .
3 1 2 2 . . .
. . . . 1 1 3
. . . . . . .
. . . . . . .
3 1 2 1 2 1 2
3 1 2 2 2 1 2
. . . . 2 1 2
. . . . 2 1 2
1 1 2 1 . . .
1 1 2 1 . . .
1 . 2 1 . . .
1 1 2 1 . . .
. . . . . . .
. . . . . . .
1 . 2 2 . . .
1 1 2 2 1 1 3
. . . . . . .
. . . . . . .
. . . . . . .
1 1 2 1 1 1 3
1 1 2 2 1 1 2
1 1 2 2 1 1 3
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
1 1 2 2 . . .
. . . . . . .
. . . . . . .
1 1 2 2 . . .
1 1 2 1 . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . 1 2 2
. . . . . . .
. . . . . . .
. . . . 1 1 2
. . . . . . .
. . . . 1 2 2
2 1 2 2 1 2 2
. . . . 1 2 2
1 . 2 1 1 1 1
. . . . . . .
. . . . . . .
2 1 2 1 2 1 3
2 2 2 2 2 1 3
2 . 2 2 2 1 3
. . . . . . .
2 1 2 2 2 1 3
. . . . 1 3 3
2 1 2 2 2 1 3
. . . . 1 1 3
. . . . 1 1 3
. . . . . . .
. . . . 1 2 3
. . . . 1 2 3
. . . . 1 2 3
. . . . 1 2 3
. . . . 1 1 3
. . . . . . .
1 2 2 2 1 1 3
. . . . . . .
. . . . 1 2 3
. . . . 1 2 3
1 1 2 1 1 1 3
1 1 2 2 1 1 3
. . . . 1 1 3
. . . . 1 1 3
. . . . . . .
1 2 2 1 1 2 3
end
label values feedingscheme feedingscheme5
label def feedingscheme5 1 "fscheme", modify
label def feedingscheme5 2 "nfscheme", modify
Please assist.

Regards
Nthato