The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Multilevel modeling in DHS-Sri Lanka
Multilevel modeling in DHS-Sri Lanka [message #16598] Tue, 05 February 2019 08:15 Go to previous message
dga1n@soton.ac.uk is currently offline  dga1n@soton.ac.uk
Messages: 9
Registered: March 2018
Location: United Kingdom
Member

Dear DHS specialists,

I need to make a community poverty variable for my multilevel analysis. Hence I generated following command using some tutorials. However when I used bys QACLUST: egen tot_in_clus3=count(QACLUST) command , it comes with the error saying "type mismatch". I need to make community poverty variable with 0 for "low"=percentage who are belongs to middle and above and 1as hight for who are belong to lowest and secondary (all five categories)

QAcluster =Is my cluster ID and QHWEALTH is my wealth index quintiles (five categories)..

gen poverty=0
replace poverty=1 if QHWLTHI<=2
*collapse poverty, by(QACLUST)
bys QACLUST: egen tot_in_clus3=count(QACLUST)
bys QACLUST : egen tot_poverty=total(poverty)
bys QACLUST: gen poverty_percent=tot_poverty*100/tot_in_clus3

gen com_poverty=0
replace com_poverty=1 if poverty_percent > 48.06854
label variable com_poverty "Community poverty"
label define com_poverty 0"low" 1"High"
label values com_poverty com_poverty


Could you kindly help me?

Thanks

Best
Gaya



gayathri
 
Read Message
Read Message
Read Message
Previous Topic: Family structure
Next Topic: Merging Datasets and Matching Observations BDHS 2007
Goto Forum:
  


Current Time: Tue Apr 23 06:08:12 Coordinated Universal Time 2024