I have a data set of 987 respondents. I asked them on there most common sources of treatment and they could choose more than one source out of a possible 10 choices. I have created the following loop and it works perfectly as i can now report frequency of each type of source of care. I would like to collapse/combine district hospital, sub district hospital, health center and dispensary into a category called "government facility" and private hospital, private clinic and mission hospital into a category called "private facility" etc. How do i go about this bearing in mind this was a multiple answers question?
Thanks in advance.
forvalues i=1/10 {
generate treatment`i' = regexm(trtmntsrc,"`i'")
replace treatment`i'=. if Trttype!=1
tab treatment`i',miss
recode treatment`i' (1=1 "Yes") (0=0 "No"), gen(treatment_new`i')
tab treatment_new`i'
}
rename treatment_new1 district_hospital
rename treatment_new2 sub_district_hospital
rename treatment_new3 health_center
rename treatment_new4 dispensary
rename treatment_new5 community_health
rename treatment_new6 mission_hospital
rename treatment_new7 private_hospital
rename treatment_new8 private_clinic
rename treatment_new9 pharmacy
rename treatment_new10 shop
Related Posts with Question on analyzing multiple answers question
Comparing samplesDear Stata users, I will please like some explanation. I am working on the topic "the effect of chi…
panel data: aggregate imputed variables to a new variable using miI am working with panel data for two waves at the moment. The dependent variable (outcome) is a bina…
Multiple Instrumental VariableHey everyone, I have the following equation: y=aX1+bX2+cX3+dX4+e I want to instrument Z1 for X1 a…
No data is running with adding "capture" to my code, but there is no new error message (this code works for my elder collegue)Dear, Sorry in advance if I'm maybe not using the right STATA-language! I'm using STATA 16.1 on Wi…
Stuck while calculating moving medianHello, Currently, I am writing my thesis, in which I have to calculate the moving median of the ROE…
Subscribe to:
Post Comments (Atom)
0 Response to Question on analyzing multiple answers question
Post a Comment