Re: Identifying siblings of a child that are below 1 years of age (R) [message #24908 is a reply to message #24867] |
Mon, 01 August 2022 12:25 |
Janet-DHS
Messages: 888 Registered: April 2022
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
Usually we at DHS would not answer a question like this, but I have always been interested in kinship and decided to work on it.
You did not say what survey you are using. I will use the Bangladesh 2017-18 survey (BD7R) to illustrate.
Two children are siblings if they have the same mother. I will re-state your question to be as follows: "For a child age A or less, how many YOUNGER siblings do they have who are age B or less." You described this with B=0 but I am generalizing. In my example, A is 17 and B is 0, 1, 2, 3, or 4. I assume the question is about living children and siblings but that could be changed.
Usually two children the same age will be twins, but I allow for that. You have to be sure not to count a child as its own sibling. The ages of living children are b8. You have to store a temporary file.
Open the BR file (BDBR7RFL.dta) in Stata. Enter the lines pasted below. Good luck.
cd e:\DHS\DHS_data\scratch
use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\BDBR7RFL.DTA" , clear
keep if b5==1
keep v001 v002 v003 bidx b8
forvalues li=0/4{
gen nsibs_age_le_`li'=0
}
sort v001 v002 v003
save index_children.dta, replace
drop nsibs*
rename bidx bidx_sib
rename b8 b8_sib
sort v001 v002 v003
joinby v001 v002 v003 using index_children.dta
forvalues li=0/4{
replace nsibs_age_le_`li'=nsibs_age_le_`li'+1 if bidx_sib<bidx & b8_sib<=`li'
}
drop bidx_sib b8_sib
collapse (sum) nsibs_age_le_* (first) b8, by(v001 v002 v003 bidx)
forvalues li=0/4{
tab b8 nsibs_age_le_`li' if b8<=17
}
|
|
|