The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Sex ratio at 2nd birth order
Sex ratio at 2nd birth order [message #27350] Mon, 24 July 2023 13:36 Go to next message
Kanika is currently offline  Kanika
Messages: 8
Registered: February 2023
Member
Hello,

I am using DFHS (2019-21) and trying to calculate sex ratio at birth at the 2nd birth order conditional on the probability that a female was born in the 1st birth order. Can anyone please help me with the code in STATA?

Thank you,
Kanika
Re: Sex ratio at 2nd birth order [message #27351 is a reply to message #27350] Mon, 24 July 2023 16:13 Go to previous messageGo to next message
Kanika is currently offline  Kanika
Messages: 8
Registered: February 2023
Member
My sincerest apologies. Yes, I mean NFHS-5, 2019-21 for India. Thank you!
Re: Sex ratio at 2nd birth order [message #27354 is a reply to message #27351] Tue, 25 July 2023 13:04 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3188
Registered: February 2013
Senior Member

Following is a response from Senior DHS staff member, Tom Pullum:

The following Stata program, which can be used with any IR file, calculates a new set of variables giving the sex of the child indexed by birth order rather than bidx (which is 1 for the most recent birth, etc.). It can be modified to be more general, if desired, to index any or all of the b variables by birth order rather than bidx.

use "...IAIR7EFL.DTA", clear

* Recode the b variables so they are indexed by bord rather than bidx
* Illustrated for just b4, sex of the child

* Based on the relationship bidx+bord=v201+1

rename *_0* *_*

* construct a new variable, sex, that is b4 indexed by bord rather than bidx

forvalues lceb=1/20 {
gen sex_`lceb'=.
quietly forvalues lbord=1/`lceb' {
local lbidx=`lceb'+1-`lbord'
replace sex_`lbord'=b4_`lbidx' if v201==`lceb'
}
}

tab1 sex_*
tab sex_2 sex_1 [iweight=v005/1000000],col

Previous Topic: Inconsistencies in v022, v024 and Appendix A Tables
Next Topic: Problem Generating A_h; M_h & M
Goto Forum:
  


Current Time: Thu Nov 7 11:26:19 Coordinated Universal Time 2024