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 next message
sumonrupop is currently offline  sumonrupop
Messages: 23
Registered: August 2015
Location: Rajshahi

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
Re: Varlist not allowed [message #12862 is a reply to message #12858] Tue, 25 July 2017 08:05 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2314
Registered: February 2013
Senior Member

Following is a response from Senior DHS Stata Specialist, Tom Pullum:

DHS staff will not help with this kind of question. I hope that other forum users will come to the rescue.
Re: Varlist not allowed [message #12866 is a reply to message #12858] Tue, 25 July 2017 09:38 Go to previous message
schoumaker is currently offline  schoumaker
Messages: 53
Registered: May 2013
Location: Belgium
Senior Member
you should type "set trace on" and run your program again to identify precisely where the program stops.

Bruno Schoumaker
Centre for Demographic Research
Université catholique de Louvain
Previous Topic: Decomposition of concentration index
Goto Forum:

Current Time: Wed Jun 23 14:36:38 Coordinated Universal Time 2021