| 
		
			| Calculating median age at first sex and percentage of respondents with sex before the age of 15 [message #11972] | Tue, 14 March 2017 10:26  |  
			| 
				
				
					|  chichi Messages: 9
 Registered: March 2017
 | Member |  |  |  
	| Hello! I am using the Namibian DHS 2013. I created one dataset with the women's, the men's and the HIV data.
 I want to calculate the median age at first sex intercourse by women and men in the age group  25-49. First I checked if I have the same number of women and men as in the final report of 2013.
 
 This was my stata code:
 tab v525 if v012 > 24 & v012 < 50 [iweight=wgt1], miss
 
 I had 7.776 respondents like in the report.  Then for calculating the median I used this code:
 
 by gender, sort : summarize v525 if v012 > 24 & v012 < 50 [aweight = wgt1], detail
 
 The median number which came out was the same as in the report. But the number of observations for men and women was different. Overall I had 7.746 respondents, 30 respondents fewer than in the report. Can someone tell what I made wrong?
 
 Further I want to get out the percentage of women and men who had sex before the age of 15.
 my code was:
 
 by gender, sort: tab v525 if v012 > 24 & v012 < 50 [iweight=wgt1], missing
 
 My result was 7.9% for women and 12.5% for men, while the report indicated 5.0% for women and 10.1% for men in the age group 25-49 years.
 
 It would be great if someone could help me or have a stata code for my intention! Thank you!
 |  
	|  |  |