The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Wealth Index » Recalculating and comparing Wealth Index for Côte d'Ivoire
Re: Recalculating and comparing Wealth Index for Côte d'Ivoire [message #19878 is a reply to message #19864] Mon, 24 August 2020 17:07 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3113
Registered: February 2013
Senior Member

Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The Stata lines listed below will do this. You should just need to change the paths. I have included some comments. The trickiest part is that you must extract v001 and v002 (or hv001 and hv002), which are numeric, from whhid, which is a string. This involves the substring and destring commands. The program shows how to do this. Let us know if you still have problems. Good luck!

set more off
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\CIWI3AFL.DTA" , clear
rename wlthindf v191
rename wlthind5 v190

list whhid if _n<=20, table clean
describe whhid

* hhid is a 12-column string that includes v001 and v002
* need to break them out; to do that we need to find which column is which

local li=1
while `li'<=12 {
gen col_`li'=substr(whhid,`li',1)
local li=`li'+1
}

list whhid col_* if _n<=20, table clean

* apparently v001 is columns 8-10 and v002 is columns 11-12
drop col_*
gen v001=substr(whhid,1,10)
gen v002=substr(whhid,11,2)
destring v*, replace
sort v001 v002

* must save this file somewhere
save e:\DHS\DHS_data\scratch\CIWItemp.dta, replace

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\CIIR3AFL.DTA" , clear
* check the number of women in this file for later comparison
codebook v000
* there are 3040 women

sort v001 v002

* I prefer the "old" version of merge but this is a many:1 merge because there can be more
*   than one woman per household

merge v001 v002 using e:\DHS\DHS_data\scratch\CIWItemp.dta
tab _merge

* _merge=2 for 524 households that have no members in the IR file; drop them
* There are 3040 women with _merge=3, same as the number in the IR file

drop if _merge==2
drop _merge
save e:\DHS\DHS_data\scratch\CI3AFL_with_WI.dta, replace
tab v190

* I have checked and this file is ok, but I am surprised that the distribution of
*   women across wealth quintiles is so uneven.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Comparative Wealth Index
Next Topic: Burkina Faso 2018 MIS WI creation
Goto Forum:
  


Current Time: Mon Jul 15 03:42:13 Coordinated Universal Time 2024