The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use (other programs) » Identifying siblings of a child that are below 1 years of age (R) (Identifying siblings of a child that are below 1 years of age (R))
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 Go to previous messageGo to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
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
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NFHS -5, Table 12.10
Next Topic: Issue with importing Individual Recode datasets for India for the years 2015-2016 on R
Goto Forum:
  


Current Time: Thu Apr 25 10:11:44 Coordinated Universal Time 2024