Wrong numbers [message #1958] |
Fri, 11 April 2014 11:52 ![Go to next message Go to next message](/theme/default/images/down.png) |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
Please help, the totals that I am getting are higher than those published in the reports
Mercy
|
|
|
|
Re: Wrong numbers [message #2012 is a reply to message #1963] |
Sun, 13 April 2014 13:31 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
Thanks Erica
Apologies for not providing details:
As a data quality assessment, I want to calculate age ratios across the population. I ran the table "Household population by age, sex, and residence" for the 2009 Lesotho, 2010 Malawi and Zimbabwe DHS but the numbers I get are higher than those published in the respective countries' reports. I also the de facto population so I do not know what is wrong
Mercy
|
|
|
|
|
|
|
|
Re: Wrong numbers [message #6857 is a reply to message #2860] |
Thu, 23 July 2015 10:12 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
Dear DHS team
I have numbers that are not matching those in the report for Lesotho 2009 but matching for Malawi and Zimbabwe. I want to calculate the % of children <18 living with both parents, father only, mother only and none of the parents. The following is the syntax:
generate weight= hv005/1000000
svyset [pw=weight], psu( hv021) strata(hv022)
*restrict to usual residence
keep if hv102==1
*restrict to <17
keep if hv105<=17
*Living arrangements of children
recode hv114 (0=0 "Not present") (1/30 =1 "Present"), gen(father_presence)
recode hv112(0=0 "Not present") (1/30 =1 "Present"),gen(mother_presence)
gen parental_presence =.
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 mother_presence ==1 & father_presence ==0
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"
label val parental_presence parental_presence
svy:tab parental_presence
Mercy
|
|
|
|
Re: Wrong numbers [message #8446 is a reply to message #8437] |
Wed, 28 October 2015 10:30 ![Go to previous message Go to previous message](/theme/default/images/up.png) ![Go to next message Go to next message](/theme/default/images/down.png) |
Trevor-DHS
Messages: 802 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
|
|
|
Re: Wrong numbers [message #12742 is a reply to message #8446] |
Thu, 06 July 2017 12:01 ![Go to previous message Go to previous message](/theme/default/images/up.png) |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
I have two follow up questions on the response below:
1. I want to categorise children whose parents are de jure household members, whose parents are migrants (living elsewhere for extended periods), those whose parents are not part of the household because they are dead or are "absent". I am having challenges to do it in stata. I copied your code below for the first two categories but having problems with the rest.
2. Are there other countries besides Lesotho that include individuals who are neither de jure nor de facto members?
Mercy
[Updated on: Sun, 09 July 2017 07:57] Report message to a moderator
|
|
|