The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Gender of the first born child
Re: Gender of the first born child [message #21982 is a reply to message #21974] Wed, 13 January 2021 08:36 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3064
Registered: February 2013
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The following lines will do what you want. You can run this on any IR file. I assign code "0" to women who have not had a first birth but of course that's optional.

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\ALIR71FL.DTA" , clear

rename b*_0* b*_*

gen sex_of_first_child=.

local li=1
while `li'<=20 {
replace sex_of_first_child=b4_`li' if bord_`li'==1
local li=`li'+1
}

replace sex_of_first_child=0 if sex_of_first_child==.

label define first_child 0 "No children" 1 "Boy" 2 "Girl"
label values sex_of_first_child first_child
tab sex_of_first_child
 
Read Message
Read Message
Read Message
Previous Topic: STATE LEVEL DATA
Next Topic: Please help! DHS Malawi youth-specific
Goto Forum:
  


Current Time: Sun May 26 17:54:54 Coordinated Universal Time 2024