The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Calculating median age at first sex
Re: Calculating median age at first sex [message #6986 is a reply to message #6929] Fri, 07 August 2015 11:31 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3063
Registered: February 2013
Senior Member
Following is a response fron Senior DHS Specialist Sarah Bradley:


You are correct: the problem was those who have never had sex, code 0 in v531. If we use v531 as-is, we are treating all those who have not had sex as though they first had sex at age 0. Please try the code below which matches the results in the Kenya 2008-09 final report.

You should also note a minor issue in the code you shared. The weight used in your svyset command (which isn't used below) should be v005/1000000, not v005.

gen wt = v005/1000000
* Recode v531, setting those who've never had sex to missing
recode v531(0=.), g(age1sex)
* Ages 20-49
tab age1sex [iweight=wt] if v013 != 1, miss
scalar age1sex2049 = 18 + (50-47.77)/(60.85-47.77)
scalar list age1sex2049
 
Read Message
Read Message
Read Message
Previous Topic: Replicating DHS values
Next Topic: Need Help
Goto Forum:
  


Current Time: Tue May 21 22:00:38 Coordinated Universal Time 2024