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 Go to next message
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
Re: Discipline and mother's education [message #31564 is a reply to message #30729] Mon, 03 November 2025 01:53 Go to previous messageGo to next message
pinoyjuander is currently offline  pinoyjuander
Messages: 1
Registered: November 2025
Member
Get fresh insights, real tips, and updates that matter -- all in one place. Visit Pinoy Juander now!Pinoy Juander

[Updated on: Mon, 03 November 2025 01:53]

Report message to a moderator

Re: Discipline and mother's education [message #31567 is a reply to message #30729] Mon, 03 November 2025 04:02 Go to previous message
juan365philippines is currently offline  juan365philippines
Messages: 1
Registered: November 2025
Member
Make Juan365 part of your daily scroll -- your go-to for fresh content every single day https://juan-365.ph/

[Updated on: Mon, 03 November 2025 04:02]

Report message to a moderator

Previous Topic: DHS questionnaire revisions
Goto Forum:
  


Current Time: Mon Nov 3 10:08:09 Coordinated Universal Time 2025