The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Discipline and mother's education (Reproducing table 20.7)
Discipline and mother's education [message #30729] Mon, 27 January 2025 17:56
Simon is currently offline  Simon
Messages: 9
Registered: October 2024
Member
Hi there again,
I'm now trying to reproduce table 20.7 in the Mozambique 2022 DHS report. In particular the breakdown by Mother's Education.

I can reproduce all the other numbers in the table.

Mother's Education is more complex since it involves a merge of datasets, as I understand it. I have used this code to merge the datasets, lifted from the DHS documentation:


* Example merging mother's characteristics into household members data (PR)
* open secondary file (household member's - PR)
* for mother's characteristics, e.g. age and level of education
use hhid hvidx hv105 hv106 hv108 using "C:\Users\Simon Cresswell\Desktop\Cornerstone\Mozambique\Dropbox files\DHS\DHS 2022\DHS Database\7. Household Members\MZPR81FL.dta", clear

* rename person ID for matching on, and mother's age and education vars
rename hvidx pid
rename hv105 byMothersAge
rename hv106 byMothersEducation
rename hv108 byMothersYearsEd
label variable byMothersAge "Mother's age"
label variable byMothersEducation "Mother's education"
label variable byMothersYearsEd "Mother's years of education"
* sort file by IDs
sort hhid pid
* save temporary data file
tempfile secondary
save "`secondary'", replace
* open primary file - also PR file
use "C:\Users\Simon Cresswell\Desktop\Cornerstone\Mozambique\Dropbox files\DHS\DHS 2022\DHS Database\7. Household Members\MZPR81FL.dta", clear
* generate person ID for matching on - based on mother's ID
gen pid = hv112
* sort file by IDs
sort hhid pid
* merge mother's characteristics into PR file
merge m:1 hhid pid using "`secondary'", keep(master match)
* check the merge - data only available for children under 18
tab _merge if hv105 < 18,m
* majority of children have mothers also in HH, but many don't

replace byMothersAge = 99 if hv112 == 0
replace byMothersEducation = 99 if hv112 == 0

*replace byMothersEducation = hc68 if hc68 >=0 & hc68 <=3
*replace byMothersEducation = 0 if byMothersYearsEd == 0

* IMPORTANT!! Remove repeated rows and leave only correct child...
keep if hvidx == hcdi2


It seems to work. However, I think the eventual definition of 'Mother's Education' is more complex that simply using hv106? It seems the only explanation for my mismatch. I have tried classifying mothers not living with the child using this line: replace byMothersEducation = 99 if hv112 == 0

And I match the percentage for that, but not for the other categories (no education, primary, secondary, higher).

Hoping you can once again help me! I can probably muddle through the CSPro code to find how the variable is built if that is easier.

Many many thanks
Simon
 
Read Message
Previous Topic: School attendance Mozambique 2022
Goto Forum:
  


Current Time: Thu Jan 30 17:47:00 Coordinated Universal Time 2025