The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Kenya » KDHS 2022: Table 5.10 Age at first birth
KDHS 2022: Table 5.10 Age at first birth [message #28340] Sat, 16 December 2023 09:53 Go to next message
sokiya is currently offline  sokiya
Messages: 78
Registered: May 2017
Location: Nairobi
Senior Member
Hello,
I am trying to replicate Table 5.10 Age at first birth in 2022 KDHS report using the code below from DHS GitHub repo

use "KEIR8AFL.dta", clear
gen wt=v005/1000000

**FIRST BIRTH
	//First birth by specific ages
	recode v212 (.=0) (0/14 = 1 "yes") (15/49 = 0 "no"), gen (fe_afb_15)
	label var fe_afb_15 "First birth by age 15"

	recode v212 (.=0) (0/17 = 1 "yes") (18/49 = 0 "no"), gen (fe_afb_18)
	replace fe_afb_18 = . if v012<18
	label var fe_afb_18 "First birth by age 18"

	recode v212 (.=0) (0/19 = 1 "yes") (20/49 = 0 "no"), gen (fe_afb_20)
	replace fe_afb_20 = . if v012<20
	label var fe_afb_20 "First birth by age 20"

	recode v212 (.=0) (0/21 = 1 "yes") (22/49 = 0 "no"), gen (fe_afb_22)
	replace fe_afb_22 = . if v012<22
	label var fe_afb_22 "First birth by age 22"

	recode v212 (.=0) (0/24 = 1 "yes") (25/49 = 0 "no"), gen (fe_afb_25)
	replace fe_afb_25 = . if v012<25
	label var fe_afb_25 "First birth by age 25"

	//Never had a first birth
	gen fe_birth_never = 0
	replace fe_birth_never = 1 if v201==0
	label val fe_birth_never yesnolabel
	label var fe_birth_never "Never had a birth"
	
	tabstat fe_afb_15 fe_afb_18 fe_afb_20 fe_afb_22 fe_afb_25 fe_birth_never [fw=v005], statistics(mean) save

but for some reason the results aren't matching. I will appreciate any help. Thanks in advance!
Re: KDHS 2022: Table 5.10 Age at first birth [message #28345 is a reply to message #28340] Mon, 18 December 2023 12:29 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3196
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

Rather than revise the (incomplete) program you included in your posting, I have put together another program (attached below) specifically for table 5.10 in the Kenya 2022 report. It includes all columns and matches perfectly. However, I see that two of the three table entries with note "a" for the median did not really need note "a". The only age group for which a median cannot be calculated is 15-19.

The medians are the only tricky numbers in this table. That's because the median calculated by Stata (using summarize, detail and r(p50)) is given as an integer value of age (v012). Many statistics texts only give the median as a value that actually occurs in the data. DHS interpolates within that year of age. For example, 21.1 would be interpreted as one tenth of the way from the 21st birthday to the 22nd birthday.

[Updated on: Mon, 18 December 2023 13:00]

Report message to a moderator

Re: KDHS 2022: Table 5.10 Age at first birth [message #28353 is a reply to message #28345] Tue, 19 December 2023 06:45 Go to previous message
sokiya is currently offline  sokiya
Messages: 78
Registered: May 2017
Location: Nairobi
Senior Member
Thanks so much for the guidance and especially the calculation of age_first_birth and the median age. I sincerely appreciate!!
Previous Topic: KDHS 2022 : Table 11.13.1 Nutritional status of women age 2049
Next Topic: Merging IR and MR Kenya 2022 (2022 KDHS)
Goto Forum:
  


Current Time: Mon Nov 18 07:28:02 Coordinated Universal Time 2024