Re: Child discipline [message #25321 is a reply to message #25296] |
Mon, 03 October 2022 14:40 |
Janet-DHS
Messages: 888 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS staff member Tom Pullum:
The Stata code pasted below should do what you want. The crucial variable is hv112. For children age 0-17 in the PR file, hv112 is the line number of the mother, if she is in the same household. The variable names for the child discipline module are different in different surveys. I use an old version of the merge command, which I prefer.
* specify a workspace
cd e:\DHS\scratch
* Find children selected for the child discipline module
use "...BUPR71FL.DTA" , clear
* to find the variable names
lookfor spank
describe sh174*
*tab1 sh174*
* to find the variable that gives the line number of the selected child
lookfor selected
* to find the structure of the data
*list hv001 hv002 hvidx hv101-hv105 sh159 sh174a if hv001==1, table clean
* save the selected children
keep if hvidx==sh159
gen cluster=hv001
gen hh=hv002
gen ch_line=hvidx
gen mo_line=hv112
gen fa_line=hv114
gen care_line=sh13b
sort cluster hh mo_line
save BU_selected_children.dta, replace
* Find the mothers
use "...BUIR71FL.DTA" , clear
gen cluster=v001
gen hh=v002
gen mo_line=v003
sort cluster hh mo_line
merge cluster hh mo_line using BU_selected_children.dta
* Now have a file of child/woman pairs
gen type=_merge
label define type 1 "Woman unmatched with child" 2 "Child unmatched with mother" 3 "Child/mother pair"
label values type type
tab type
|
|
|