Home » Countries » Ethiopia » malawi (logistic regression )
Re: malawi [message #17608 is a reply to message #17557] |
Fri, 26 April 2019 10:22 |
Bridgette-DHS
Messages: 3214 Registered: February 2013
|
Senior Member |
|
|
Following is another response from Senior DHS Stata Specialist, Tom Pullum:
Sorry for the delay with this response. Perhaps you have already answered the question yourself.
Your Stata code is well written and correct. I have made some modifications and will paste my revised version below. The 232 and 338 are not a problem. The units of analysis in the IR file are women, and the units of analysis for table 8.4 are stillbirths (in column 1) and early neonatal deaths (in column 2). Four women who had two neonatal deaths, and 228 had one. Thus 232 women experienced at least one neonatal death, but the total number of neonatal deaths was 236. You can convert from a file of women to a file of neonatal deaths with the "expand" command, as shown. Similarly for early neonatal deaths.
As you will see, I generally save a working file in a "scratch" folder--you would do something else--in order to move easily from column 1 to column 2 of table 8.4.
Regarding your second question--women with parity 0 have had no live births. That's why they have no early neonatal deaths, even if they may have had stillbirths.
Open MWIR7HFL.dta
gen stillbirths = 0
label variable stillbirths "Stillbirths"
gen births = 0
label variable births "Births in calendar"
gen births2 = 0
label variable births2 "Births in birth history"
gen earlyneo = 0
label variable earlyneo "Early neonatal deaths"
gen infant_deaths=0
label variable infant_deaths "infant deaths"
gen child_deaths=0
label variable child_deaths "child deaths"
gen beg = v018
gen end = v018+59
local vcal_len = strlen(vcal_1[1])
quietly forvalues i = 1/`vcal_len' {
replace births = births+1 if inrange(`i',beg,end) & substr(vcal_1,`i',1) == "B"
replace stillbirths = stillbirths+1 if inrange(`i',beg,end) & substr(vcal_1,`i',7) == "TPPPPPP"
}
replace end = v008
replace beg = v008-59
rename b3_0* b3_*
rename b6_0* b6_*
quietly forvalues i = 1/20 {
replace births2 = births2+1 if inrange(b3_`i',beg,end)
replace earlyneo = earlyneo+1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,106)
replace infant_deaths = infant_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,211)
replace child_deaths = child_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',212,304)
}
gen totpreg7m = births2+stillbirths
label variable totpreg7m "Number of pregnancies of 7+ months duration"
gen perinatal = earlyneo+stillbirths
label variable perinatal "Perinatal mortality"
gen wt = v005/1000000
gen parity=v224
replace parity=5 if parity>5
label variable parity "Parity"
label define parity 5 "5+"
label values parity parity
svyset v021 [pw = wt], strata(v023) singleunit(centered)
svy: tab parity earlyneo, count cellwidth(12) format(%12.2g)
save e:\DHS\DHS_data\scratch\temp.dta, replace
tab stillbirths if stillbirths>0 [iweight=v005/1000000]
expand stillbirths
tab stillbirths if stillbirths>0 [iweight=v005/1000000]
* get column 1 of table 8.4 from this file
use e:\DHS\DHS_data\scratch\temp.dta, clear
tab earlyneo if earlyneo>0 [iweight=v005/1000000]
expand earlyneo
tab earlyneo if earlyneo if earlyneo>0 [iweight=v005/1000000]
* get column 2 of table 8.4 from this file
|
|
|
Goto Forum:
Current Time: Sun Dec 22 02:08:30 Coordinated Universal Time 2024
|