The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » Pregnancy outcomes in India DHS 2019-21 (Pregnancy outcomes)
Re: Pregnancy outcomes in India DHS 2019-21 [message #29054 is a reply to message #29051] Thu, 18 April 2024 05:58 Go to previous messageGo to previous message
anjalibansal6693 is currently offline  anjalibansal6693
Messages: 24
Registered: February 2018
Member
Thanks for the reply

I was trying to do match 6.15 table for India, but the percentage is matching with the shared code but the sample size is not matching.

The code :

quietly forvalues lcol=1/80 {
gen type_`lcol'=.
replace type_`lcol'=1 if substr(vcal_1,`lcol',1)=="B"
replace type_`lcol'=2 if substr(vcal_1,`lcol',1)=="T"

gen interval_`lcol'= .
replace interval_`lcol'= 0 if substr(vcal_1,`lcol'+1,1)~="P" & `lcol'+1<=80
replace interval_`lcol'= 1 if substr(vcal_1,`lcol'+1,1) =="P" & substr(vcal_1,`lcol'+2,1)~="P" & `lcol'+2<=80
replace interval_`lcol'= 2 if substr(vcal_1,`lcol'+1,2) =="PP" & substr(vcal_1,`lcol'+3,1)~="P" & `lcol'+3<=80
replace interval_`lcol'= 3 if substr(vcal_1,`lcol'+1,3) =="PPP" & substr(vcal_1,`lcol'+4,1)~="P" & `lcol'+4<=80
replace interval_`lcol'= 4 if substr(vcal_1,`lcol'+1,4) =="PPPP" & substr(vcal_1,`lcol'+5,1)~="P" & `lcol'+5<=80
replace interval_`lcol'= 5 if substr(vcal_1,`lcol'+1,5) =="PPPPP" & substr(vcal_1,`lcol'+6,1)~="P" & `lcol'+6<=80
replace interval_`lcol'= 6 if substr(vcal_1,`lcol'+1,6) =="PPPPPP" & substr(vcal_1,`lcol'+7,1)~="P" & `lcol'+7<=80
replace interval_`lcol'= 7 if substr(vcal_1,`lcol'+1,7) =="PPPPPPP" & substr(vcal_1,`lcol'+8,1)~="P" & `lcol'+8<=80
replace interval_`lcol'= 8 if substr(vcal_1,`lcol'+1,8) =="PPPPPPPP" & substr(vcal_1,`lcol'+9,1)~="P" & `lcol'+9<=80
replace interval_`lcol'= 9 if substr(vcal_1,`lcol'+1,9) =="PPPPPPPPP" & substr(vcal_1,`lcol'+10,1)~="P" & `lcol'+10<=80
replace interval_`lcol'=10 if substr(vcal_1,`lcol'+1,10)=="PPPPPPPPPP" & substr(vcal_1,`lcol'+11,1)~="P" & `lcol'+11<=80
replace interval_`lcol'=11 if substr(vcal_1,`lcol'+1,11)=="PPPPPPPPPPP" & substr(vcal_1,`lcol'+12,1)~="P" & `lcol'+12<=80
}

reshape long type_ interval_, i(v001 v002 v003) j(col)
rename *_ *

drop if type==.
label variable type "Type of pregnancy outcome"
label define type 1 "Live birth" 2 "Termination"
label values type type

ta type [iweight=v005/1000000]
 
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: Clarification of "Sex" variable in PR data file
Next Topic: DHS INDIAN SURVEY DATASET
Goto Forum:
  


Current Time: Thu Sep 5 12:04:48 Coordinated Universal Time 2024