The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » Replicating DHS tables on child health
Re: Replicating DHS tables on child health [message #8579 is a reply to message #8565] Wed, 18 November 2015 01:17 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 805
Registered: January 2013
Senior Member
See the below code for examples for question 1 and 2.
cd "C:\Data\DHS_Stata\"
* Use kids recode dataset
use "UGKR60FL.DTA", clear

* set weight
g wt=v005/1000000

* Q1. 

* create mother's age at birth variable =
* CMC date of birth of child - CMC date of birth of woman - , divided into 15 year groups (180 months)
g mageatb = b3 - v011
recode mageatb (0/239 = 1 "<20") (240/419 = 2 "20-34") (420/599 = 3 "35-49"), g(mab)
lab var mab "Mother's age at birth"
tab mab [iw=wt]

* creates smokes variable
g smokes = 2
replace smokes = 1 if v463a == 1 | v463b == 1
*replace smokes = 9 if smokes == 2 & (v463a == 9 | v463b == 9)
lab def smokes 1 "Smokes cigarettes/tobacco" 2 "Does not smoke"
lab var smokes "Mother's smoking status"
lab val smokes smokes
tab smokes [iw=wt]
Note that there appears to be a typing error in table 10.1 and the number of women who do not smoke should be 8010, not 8000.

* Q2. 

* Diarrhea
g diarrhea = (h11==2) if b5==1
tab diarrhea [iw=wt] if b5==1
* Diarrhea with blood
g diarr_bld = (h11b==1) if b5==1
tab diarr_bld [iw=wt] if b5==1

For question 3, the tab commands above provide the numbers of children as well as the percentages.
For question 4, a simple way of producing the output you need is to try something like the following:
* Q4.

g total = 0
foreach var in v102 v101 v190 total { 
  tab `var' diarrhea [iw=wt] if b5==1, row
}

This produces results for a number of background characteristics, but not a single table.
If you want to produce tables that looks like those in the report, you can try using alternative tabulation commands, such as tabout, or use a different software to produce the output desired (DHS uses CSPro with some additional tools to produce the tables as found in the reports).
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Homemade fluids and SSS for diarrhoea
Next Topic: Number of under five children in the family
Goto Forum:
  


Current Time: Fri Dec 6 21:56:16 Coordinated Universal Time 2024