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
 Trevor-DHS Messages: 788Registered: 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).

 Replicating DHS tables on child health By: lexgw on Mon, 16 November 2015 19:00 Re: Replicating DHS tables on child health By: Trevor-DHS on Wed, 18 November 2015 01:17 Re: Replicating DHS tables on child health By: lexgw on Wed, 18 November 2015 07:41 Re: Replicating DHS tables on child health By: lexgw on Wed, 18 November 2015 18:47 Re: Replicating DHS tables on child health By: lexgw on Thu, 26 November 2015 17:46 Re: Replicating DHS tables on child health By: Trevor-DHS on Thu, 03 December 2015 11:55 Re: Replicating DHS tables on child health By: Trevor-DHS on Thu, 03 December 2015 11:58 Re: Replicating DHS tables on child health By: Trevor-DHS on Wed, 18 November 2015 19:05 Re: Replicating DHS tables on child health By: lexgw on Thu, 19 November 2015 09:32 Re: Replicating DHS tables on child health By: lexgw on Thu, 19 November 2015 20:07 Re: Replicating DHS tables on child health By: Trevor-DHS on Thu, 19 November 2015 23:06 Re: Replicating DHS tables on child health By: lexgw on Sat, 21 November 2015 05:55 Re: Replicating DHS tables on child health By: Trevor-DHS on Sat, 21 November 2015 15:13 Re: Replicating DHS tables on child health By: lexgw on Sat, 21 November 2015 21:12 Re: Replicating DHS tables on child health By: Trevor-DHS on Sun, 22 November 2015 17:59 Re: Replicating DHS tables on child health By: lexgw on Mon, 23 November 2015 09:22 Re: Replicating DHS tables on child health By: Trevor-DHS on Mon, 23 November 2015 10:50 Re: Replicating DHS tables on child health By: lexgw on Mon, 23 November 2015 10:56 Re: Replicating DHS tables on child health By: Trevor-DHS on Mon, 23 November 2015 10:58 Re: Replicating DHS tables on child health By: lexgw on Mon, 23 November 2015 11:00 Re: Replicating DHS tables on child health By: lexgw on Mon, 23 November 2015 11:05 Re: Replicating DHS tables on child health By: sammy nyarko on Sat, 10 December 2016 10:59 Re: Replicating DHS tables on child health By: sammy nyarko on Sun, 11 December 2016 03:47 Re: Replicating DHS tables on child health By: lexgw on Mon, 23 November 2015 11:16 Re: Replicating DHS tables on child health By: Trevor-DHS on Mon, 23 November 2015 11:19 Re: Replicating DHS tables on child health By: lexgw on Thu, 10 December 2015 08:35 Re: Replicating DHS tables on child health By: lexgw on Thu, 10 December 2015 09:23 Re: Merging By: lexgw on Thu, 04 August 2016 13:36 Re: Merging By: Trevor-DHS on Fri, 05 August 2016 18:13 Re: Merging By: lexgw on Fri, 05 August 2016 20:25
 Previous Topic: Homemade fluids and SSS for diarrhoea Next Topic: Number of under five children in the family
Goto Forum:

Current Time: Tue Apr 16 00:45:22 Coordinated Universal Time 2024