The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Wrong numbers
Re: Wrong numbers [message #8446 is a reply to message #8437] Wed, 28 October 2015 10:30 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 789
Registered: January 2013
Senior Member
Your code does not take into account a few things:

1) The code did not consider whether the father or mother was dead. This is added by checking for . in the recode statements.

2) In Lesotho all family members are listed in the household schedule, including those that do not usually live in the household. To see if they live together you need to check if both the child and the parent usually live in the household. The important piece for this is to check hv102 for the father or mother. This is done with the following logic:
hv102[_n-hvidx+hv114] != 1
This logic refers to the data record for the father (or mother) by taking the current record number (_n), subtracting the child's line number (hvidx) to find the record before the start of the household, and then adding the father's (or mother's) line number (hv114 or hv112) to find the record for the parent. For this to work, all household members must be kept in the dataset, so the "keep if" commands have been removed, and the selection for children under 18 who were usual members of the household has been put on the svy:tab command instead (if hv102==1 & hv105 <= 17).

3) The code also needs to take into account cases where it was unknown if the father or mother was still alive, that is if hv113 was 8 or 9, or hv111 was 8 or 9.

Try the below code:

use LSPR60FL.DTA, clear

generate weight= hv005/1000000
svyset [pw=weight], psu(hv021) strata(hv022)

* sort to ensure that the household listing is in order
sort hhid hvidx

*Living arrangements of children
recode hv114 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(father_presence)
recode hv112 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(mother_presence)
replace father_presence=9 if inrange(hv113,8,9)
replace mother_presence=9 if inrange(hv111,8,9)

* need to take into acount whether father or mother usually live in the household
replace father_presence=0 if father_presence==1 & hv102[_n-hvidx+hv114] != 1
replace mother_presence=0 if mother_presence==1 & hv102[_n-hvidx+hv112] != 1

* 
gen parental_presence = 9
replace parental_presence = 1 if father_presence == 1 & mother_presence == 1 
replace parental_presence = 2 if father_presence == 1 & mother_presence == 0
replace parental_presence = 3 if father_presence == 0 & mother_presence == 1 
replace parental_presence = 4 if father_presence == 0 & mother_presence == 0

label var parental_presence parental_presence 
label define parental_presence 1 "Both" 2 "Father only" 3 "Mother only" 4 "None" 9 "DK/Missing"
label val parental_presence parental_presence 
svy:tab parental_presence if hv102==1 & hv105 <= 17

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Afghanistan DHS Survey Persian Calendar
Next Topic: Head of house hold determinants
Goto Forum:
  


Current Time: Mon Apr 29 08:38:08 Coordinated Universal Time 2024