|
Re: Replicating DHS tables on child health [message #8579 is a reply to message #8565] |
Wed, 18 November 2015 01:17 |
Trevor-DHS
Messages: 802 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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Replicating DHS tables on child health [message #8703 is a reply to message #8667] |
Thu, 03 December 2015 11:55 |
Trevor-DHS
Messages: 802 Registered: January 2013
|
Senior Member |
|
|
1a) M18 in the KR file contains the size at birth variable. For size at birth you first need to merge UGKR60FL.DTA to UGPR60FL.DTA. First sort the PR file on hv001 hv002 and hvidx, and the KR file on v001 v002 and b16. Drop cases from the KR file that have b16 == 0 or 99 or missing (.) as these are children that do not live in the household, died, or had other missing data. Then perform a 1:1 merge.
1b) For mother's interview status, you need to look at hv111 and hv112, and then for cases where hv112 is not 0, 99, or missing (.) you need to merge the IR file to see if the mother was successfully interviewed. Use hv001 hv002 and hv112 from the PR file and v001 v002 and v003 from the IR file for the merge. This should be a many to one (m:1) merge from the PR file using the IR file as the mother may have had more than one child. Note that you will need to sort on the above fields first before merging.
1c) For mother's nutritional status, you need to use HA40 for the mother. This get's trickier as you already have an ha40 in the child's record, but it will be blank. You will need to drop this variable, and then merge in ha40 for the mother from another copy of the PR file. To do this, you will need:
- your PR file sort based on hv001 hv002 and hv112, and with ha40 dropped. gen mother=hv112
- a copy of the original PR file sorted on hv001 hv002 and hvidx. gen mother=hvidx
You will then merge 1:1 using hv001 hv002 and mother, and just add ha40 from the copy of the PR file to your main PR file.
2) For the preceding birth interval, once you have done the merge of the KR file in the first step above, then just use B11. B11 is set to missing for first births, so just recode the durations into the groups you need and the missing (.) to the category for first birth.
|
|
|
|
|
|
|
|
|
Re: Replicating DHS tables on child health [message #11390 is a reply to message #8635] |
Sat, 10 December 2016 10:59 |
sammy nyarko
Messages: 5 Registered: December 2016 Location: Ghana
|
Member |
|
|
im trying to follow your steps but got stuck. After the command below.
recode hc1 (0/5=1 "<6")(6/8=2 "6-8")(9/11=3 "9-11")(12/17=4 "12-17")(18/23=5 "18-23")(24/35=6 "24-35")(36/47=7 "36-47")(48/59=8 "48-59")if hv120==1 & survey==1, gen (age_months2)
this was my responds
variable survey not
|
|
|
|