The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging IR file with KR (Csection )
Re: merging IR file with KR [message #17539 is a reply to message #16822] Wed, 10 April 2019 21:41 Go to previous message
mmbah is currently offline  mmbah
Messages: 8
Registered: March 2019
Member
Dear Mlue,

Thanks you very much for the codes as they are very helpful. I wanted to calculate the number of ealy neonatal mortality and perinatal mortality. However, when I reshape the data using the codes you provide i have over 150000 observations. If I calculate the early neonatal and perinatal deaths, bmi, parity using the below commands before or after the reshaping i get wrong estimation due to the high number of observation.I really need help.

replace end = v008
replace beg = v008-59

* rename b3 and b6 variables to facilitate use in the for loop
rename b3_0* b3_*
rename b6_0* b6_*

* Loop through birth history summing births and early neonatal deaths
* in the five years preceding the survey
forvalues i = 1/20 {
* restrict to 60 months preceding survey
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)
}
gen perinatal = earlyneo+stillbirths
label variable perinatal "Perinatal mortality"

label define bmic 1"Underweight" 2"Normal" 3"Overweight/obese"
gen bmi= v445/100
label var bmi "bmi"
gen bmic= 1 if bmi<18.5
replace bmic=2 if bmi>=18.5 & bmi<25
replace bmic=3 if bmi>=25 & bmi!=.
label values bmic bmic
label var bmic "bmic"
tab bmic
rename v201 parity
recode parity 0/1=1 2=2 3=3 4=4 5/max=5
tab parity
label define paritylab 5"5+"
label var parity paritylab
label value parity paritylab
tab parity
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging all DHS recode files for one country in Stata
Next Topic: Merging IR and PR?
Goto Forum:
  


Current Time: Tue Jun 2 11:36:38 Eastern Daylight Time 2020