/*IPUMS MICS Webinar on Linking across units of analysis Presenter: Anna Bolgrien, Project Manager of IPUMS MICS April 15, 2026 */ /*File preperation for Stata example Create 3 data extracts with the sample Sierra Leone 2017. Create extract for: Household Member (HL) unit of analysis with the variables sample, cluster, hhno, lineno, linenomom, linenodad, age, sex, relate Children age 0-4 (CH) unit of analysis with the variables sample, cluster, hhno, linech, linemc, agech, sexch Woman (WM) unit of analysis with the variables sample, cluster, hhno, linewm, agewm Download these extract, unzip, run the provided harmonization do file, rename. sl2017a_hl.dta sl2017a_ch.dta sl2017a_wm.dta */ *Starting with the HL dataset use sl2017a_hl.dta, clear *Look at some example families *This family has 2 parents and 3 children. list lineno relate sex age linenomom linenodad if cluster==1 & hhno==9 *Man with 2 wives with multiple children and 6 foster/adopted children list lineno relate sex age linenomom if cluster==20 & hhno==9 *within this HH we can see that some children's fathers have died, so non are orphans. But the children's mothers/fathers don't live in HH (Fostered) *This family has multi-generational relationships list lineno relate sex age linenomom linenodad if cluster==4 & hhno==15 *This is the family we will look at for the rest of the examples. *Close out of the household member file. Open the Child age 0-4 file. use sl2017a_ch.dta, clear *Find the 2 children in the household listed above (Cluster 4, HHno 15) list linech sexch agech linemc if cluster==4 & hhno==15 *Create a linking key back to the HL file. gen lineno=linech save sl2017a_ch_1.dta,replace *Open the WM data file. use sl2017a_wm.dta, clear *Identify the 2 women from the household listed above (cluster 4, hhno 15) list linewm agewm if cluster==4 & hhno==15 *Create a linking key to the biological mother among children in the household roster (HL) gen linenomom=linewm save sl2017a_wm_1.dta, replace *Returning to the HL file. use sl2017a_hl.dta, clear *View the example household (cluster 4, hhno 15) list lineno relate sex age if cluster==4 & hhno==15 *merge CH information onto children in the household roster. merge 1:1 sample cluster hhno lineno using sl2017a_ch.dta rename _merge _mergech *View the example household (cluster 4, hhno 15) to identify that the 2 children now have linked information from the CH record. list lineno age sex agech sexch if cluster==4 & hhno==15 *From the HL roster, merge information about the WM if they are listed as the biological mothers for children 0-17 in the household merge m:1 sample cluster hhno linenomom using sl2017a_wm.dta sort cluster hhno lineno *View the example household (cluster 4, hhno 15) to see the information about the women in the household has been linked to the appropriate children in the household. list lineno age sex agech sexch linenomom linemc linewm agewm if cluster==4 & hhno==15 *To identify caregivers that are not biological mothers, *Create a flag variable that identifies when the caregiver is the same as the biological mother gen biomom=1 if linemc==linenomom & linemc!=. *Create the inverse flag relationship when the caregiver is not the biolgoical mother replace biomom=0 if linemc!=linenomom & linemc!=. *View the flag variable tab biomom *Look at an example household where the caregiver is not the biological mother for some of the children list lineno relate sex age linenomom linemc biomom if cluster==20 & hhno==9