The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Fertility » Teenage pregnancies by year 2015 to 2022 (Teenage pregnancies)
Teenage pregnancies by year 2015 to 2022 [message #28690] Sat, 24 February 2024 08:30 Go to next message
Melyn is currently offline  Melyn
Messages: 2
Registered: February 2024
Member
Dear DHS team,

I am using the Kenya DHS 2022 Stata dataset (IR) and would like to analyse teenage pregnancies (age group 15-19) by year for the years 2015 to 2022.

For the years, is p2_01 - p2_20 the right variables to consider? For the pregnancies, the DHS online guide states the variables v201, v213 and v245 to be the ones relating to teenage pregnancy. Is that right?

I am specifically stuck on how I should relate, generate and analyse these variables in Stata to come up with meaningful descriptive summary statistics, line plots and even trend analyses to assess teenage pregnancies by year. I want to evaluate whether teenage pregnancies increased after 2020.

Please assist me with the Stata codes for my analyses.

Thanks in advance.
Re: Teenage pregnancies by year 2015 to 2022 [message #28790 is a reply to message #28690] Thu, 07 March 2024 15:50 Go to previous messageGo to next message
Melyn is currently offline  Melyn
Messages: 2
Registered: February 2024
Member
My goal is to analyse teenage pregnancies by year (2017 to 2022). This is what I have managed to do on Stata. My reshape command, even though it produces results, does not give the desired transformation of the dataset. This is where I am stuck and need help. I imagine a transformed dataset having 3 variables: Year (2017-2022), Total teenage pregnancies and Age-groups.

use KEIR8BFL.DTA, clear

*TEENAGERS: age-groups 15-19 and 20-24
keep if v013==1 | v013==2


*YEARS FOR ANALYSIS: keep only years 2017 to 2022 for the variables relating to year of pregnancy outcome (p2_01 to p2_20)
foreach var of varlist p2_01-p2_20 {

replace `var' = 0 if `var' < 2017 | `var' > 2022
}

*assess which variables have missing observations (zero values)
foreach var of varlist p2_01-p2_20 {
tabulate `var', missing
}

*drop pregnancy outcome variables with missing observations
drop p2_10-p2_20


*TEENAGE PREGNANCY VARIABLES: v201 "Total children ever born", v213 "Currently pregnant", v245 "Pregnancy losses"
*keeping only variables required for analysis of 2017 to 2022 trend analysis of teenage pregnancies for the age groups 15-19 and 20-24
keep v201 v213 v245 v013 p2_01-p2_09


*Recode "v213" into "preg_status_numeric" by generating a new variable "preg_status_numeric" based on "v213" such that "no or unsure" takes the value "0" and "yes" takes "1"
recode v213 (0=0) (1=1), generate(preg_status_numeric)

drop v213

*Rename variable to original name for ease of referencing
rename preg_status_numeric v213

*Generate a variable that sums up teenage pregnancies for the 3 related variables
gen Total_TeenagePreg=v201+v213+v245

*TRANSFORMING THE DATA for ease of analysis
*Sort the dataset by the age-group variable
sort v013

*Creating a new identifier variable named "id"
gen id = _n

*reshape the variables p2_01 through p2_09 from wide to long format, creating a new variable named outcome_year
reshape long p2_, i(id) j(outcome_year)
Re: Teenage pregnancies by year 2015 to 2022 [message #28912 is a reply to message #28790] Wed, 27 March 2024 11:54 Go to previous message
Janet-DHS is currently offline  Janet-DHS
Messages: 698
Registered: April 2022
Senior Member
Thank you for submitting your question. We are working on a response, but the erratum is still not posted.
Previous Topic: Calculating fertility rates
Goto Forum:
  


Current Time: Sat Apr 27 03:51:55 Coordinated Universal Time 2024