Re: Merged Housedhold and Domestic Violence dataset [message #22398 is a reply to message #22378] |
Fri, 05 March 2021 19:23 |
Bridgette-DHS
Messages: 3214 Registered: February 2013
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
First question: The line number of the household respondent is given by hv003 for everyone in the household. The sex of that person is given by hv104. If you want to attach that to everyone in the household, you can use these lines in Stata, with the PR file:
gen temp=hv104 if hvidx==hv003
list hv001 hv002 hv003 hvidx hv104 temp if _n<=100, table clean
egen hhresp_hv104=min(temp), by(hv001 hv002)
drop temp
list hv001 hv002 hv003 hvidx hv104 hhresp* if _n<=100, table clean
The "list" lines will show you how the gen and egen lines work. You can extend this to copy other characteristics of the household respondent onto every every person in the household.
Second question: The relevant line number for the child who was selected for the child discipline module in the Myanmar survey was sh148. As I said the other day, sh148-sh161 were copied onto the record for every person in the household. You can restrict to the reference children just with "keep if hvidx==sh148" and then you have the age of the child as hv105. Alternatively, if you just want to make those children more identifiable but keep everyone in the PR file, you could do the following to make the sh variables ".", for NA, in the PR file:
local cdvars sh148 sh149 sh150 sh151 sh152 sh153 sh154 sh155 sh156 sh157 sh158 sh159 sh160 sh161
list hv001 hv002 hvidx hv105 sh148-sh152 if _n<=100, table clean
foreach cdvar of local cdvars {
replace `cdvar'=. if hvidx~=sh148
}
list hv001 hv002 hvidx hv105 sh148-sh152 if _n<=100, table clean
Again, the "list" lines are just for checking.
|
|
|