Linking adult children (>15) to their parents [message #12784] |
Thu, 13 July 2017 06:18 |
Juliette
Messages: 3 Registered: February 2015
|
Member |
|
|
Dear DHS-experts,
I'm currently trying to link parents and children living in the same household in order to compare some answer in the women and men questionnaires, hence I want both parents and children who answered the "over 15" questionnaire in the same database.
Do you have any advice in creating such a database?
Here's what I've tried for the case Ivory Coast, DHS 1994.
Quote:
use "$path/CIPR35FL.DTA", clear
* no line number of parents if children are older than 15
* keep heads of hh, their spouses & children
keep if hv101==1 | hv101==3 | hv101==2
*
gen eligibility=1 if hv117==1 |hv118==1
gen sondaughter=1 if hv101==3 & eligibility==1
gen head=1 if hv101==1 & eligibility==1
gen spouse=1 if hv101==2 & eligibility==1
bysort hhid: egen nbsd=count(sondaughter)
bysort hhid: egen nbhead=count(head)
bysort hhid: egen nbspouse=count(spouse)
*
gen keephh=1 if nbhead==1 & nbsd>=1 & nbspouse>=1
recode keephh (.=0)
*
keep if keephh==1
* MERGING WITH DATA FROM WOMEN AND MEN FILES
* ID: cluster_hh_line nb_age_survey
egen wuid=concat(hv001 hv002 hvidx hv007), punct(_)
egen muid=concat(hv001 hv002 hvidx hv007), punct(_)
drop if eligi!=1
*
merge 1:1 wuid using "$path/CI_women_94.DTA"
drop if _merge==2
merge 1:1 muid using "$path/CI_men.DTA", gen(merge)
drop if merge==2
Many thanks for your help!
[Updated on: Thu, 13 July 2017 07:18] Report message to a moderator
|
|
|