Project

General

Profile

Actions

Support #1498

open

Create child id in BHPS and assign them their parents' work status

Added by Mario Martinez-Jimenez almost 4 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Category:
-
Start date:
02/02/2021
% Done:

100%


Description

Dear Sir or Madam,

I have managed to create a mother, father, and children identifier using the EGOALT file in BHPS waves. However, I am struggling in how to assign for each child id their parents work status. So far, I have done this:

use "$dataout\egoaltPanelSmall", clear

//Generate the partner id:
g long partner_pidp=apidp

//Generate the mother, and father id:
g long mother_pidp=apidp if relationship_bh>=4 & relationship_bh<=7 & asex==2
g long father_pidp=apidp if relationship_bh>=4 & relationship_bh<=7 & asex==1
g long grandmother_pidp=apidp if relationship_bh==20 & asex==2
g long grandfather_pidp=apidp if relationship_bh==20 & asex==1

save "$dataout\temp_egoalt", replace

use "$dataout\egoaltPanelSmall", clear

// Only keep children of EGO
keep if relationship_bh>=9 & relationship_bh<=12
count

fre wave
// attach age variables of ALTER
keep pidp apidp relationship_bh esex asex
rename pidp xpidp // xpidp: ego identifier who are parents of these children
rename apidp pidp //pidp: this now are actually the id of children
merge m:1 pidp using "$dataout\indallPanelSmallVar", keepusing(pidp age_indall wave)
drop if _m==2
drop _m

rename pidp kpidp
label var kpidp "cross-wave identifier of child"

rename age_indall kage
label var kage "child's age"

rename asex ksex
lab var ksex "child's sex"

rename xpidp pidp

**// Assign parent’s work status variable values:
Mother’s:
foreach v in sex_dv mastat_dv jbstat {
bysort hidp mother_pidp: ge m_`v' = cond(n==1, `v'[1], `v'[2], .) ///
if partnum < .
lab val m`v' `v'
}
Fathers’:
foreach v in sex_dv mastat_dv jbstat {
bysort hidp father_pidp: ge f_`v' = cond(n==1, `v'[1], `v'[2], .) ///
if partnum < .
lab val f`v' `v'
} **
It would be something like that?
Thank you so much for your kind of answer – it helps me a lot to solve how to identify children inside a household.

Best wishes,

Mario


Files

merge_egoaltBHPS.do (8.53 KB) merge_egoaltBHPS.do Merge egoalt files from wave 1 to 18 BHPS Mario Martinez-Jimenez, 02/02/2021 09:30 AM
parents_children_matching_public.do (2.08 KB) parents_children_matching_public.do Understanding Society User Support Team, 02/03/2021 08:06 AM
merge_childrenBHPS.do (6.95 KB) merge_childrenBHPS.do Create the mother, father and child id Mario Martinez-Jimenez, 02/08/2021 04:45 PM
parents_children_matching.do (3.33 KB) parents_children_matching.do Create parents variables and merge them with children id Mario Martinez-Jimenez, 02/08/2021 04:45 PM
parents_children_matching_public_v2.do (2.83 KB) parents_children_matching_public_v2.do Understanding Society User Support Team, 02/11/2021 12:27 PM
Actions

Also available in: Atom PDF