The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Varlist not allowed
Varlist not allowed [message #12858] Mon, 24 July 2017 23:52 Go to previous message
sumonrupop is currently offline  sumonrupop
Messages: 23
Registered: August 2015
Location: Rajshahi
Member

Dear All,
I am trying to do decomposition analysis using DHS data. I wrote the command given below. But when I run the program, it is stopped and shows error message "varlist not allowed". Can anyone help me please to solve this problem?

//use cdelivery_decomposfinal, clear
**concentration index_corrected version
egen raw_rank= rank(quintile), unique
sort raw_rank
quietly sum v005
gen wi=v005/r(sum)
gen cusum=sum(wi)
gen wj=cusum[_n-1]
replace wj=0 if wj==.
gen rank=wj+0.05*wi
//drop raw_rank wi cumsum wj

qui sum m17_1[aw=v005]
scalar mean= r(mean)
cor m17_1 rank [aw=v005], c
sca c=(2/mean)*r(cov_12)
sca list c
sca CI=8*r(cov_12)
//sca list c
display "concentration index by convenient covariance method", CI

**Computing the semi-elasticities, CI and contributions of each factor
//clear matrix
global X "quintile1 quintile2 quintile3 quintile4 quintile5 resd1 resd2"
qui regress m17_1 $X [pw=v005]
***decomposition start here
foreach x of global X {
qui {
sca b_'x'=_b['x']
corr rank 'x' [pw=v005], c
sca cov_'x'=r(cov_12)
sum 'x' [pw=v005]
sca elas_'x'= (b_'x'*r(mean))/m_y
sca CI_'x'=2*cov_'x'/r(mean)
sca con_'x'= elas_'x'*CI_'x'
sca prcnt_'x'= con_'x'/CI
}
di "'x' elasticity:", elas_'x'
di "'x' concentration index:'", CI_'x'
di "'x' contribution:", con_'x'
di "'x' percentage contribution:", prcnt_'x'
}
Thanks in advanece


Md. Nuruzzaman Khan
 
Read Message
Read Message
Read Message
Previous Topic: Decomposition of concentration index
Next Topic: DECOMPOSING ERREYGERS CONCENTRATION INDEX - STATA
Goto Forum:
  


Current Time: Thu Mar 28 14:13:26 Coordinated Universal Time 2024