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
Calculating median age at first sex [message #6929] Tue, 04 August 2015 18:06 Go to previous message
maras224 is currently offline  maras224
Messages: 2
Registered: August 2015
Member
I am trying to calculate median age at first sex, marriage, and birth in multiple countries and years.

I have succeeded in calculating age at first marriage and birth using the formula previously provided on this forum.( http://userforum.dhsprogram.com/index.php?t=msg&th=1337& amp;goto=2470&S=08c954804736d97c007deae6e959abed#msg_247 0)

An example of my working Stata code is below. However, when I attempt to calculate median age at first sex (v531), I am unable to replicate the numbers provided in published reports. I believe this may have to do with categories that may need to be excluded, such as 0 - Not had intercourse, 97 - inconsistent, or 98 - don't know.

Has anyone successfully replicated the published medians for age at first sex, and if so, how? Thanks for your help.

use "KEIR52FL.DTA", clear
svyset v021 [pweight=v005], strata(v023)

* Median age at first marriage
* Ages 20-29
tab v511 [iweight=v005/1000000] if v013 >= 2 & v013 <= 3, missing
scalar mafm2029 = 20 + (50-46.45)/(54.98-46.45)
scalar list mafm2029

 
Read Message
Read Message
Read Message
Previous Topic: Replicating DHS values
Next Topic: Need Help
Goto Forum:
  


Current Time: Sat Nov 9 09:40:28 Coordinated Universal Time 2024