I am working on DHS data. I am analyzing the type of facilities used by women for antenatal care. I am coding 12 variables to create one categorical variable. I am combining them either as Private, Public, or Home categories. I have run the following codes but I have run into issues when I am doing regression analysis. The issue arise because some women who received antenatal care at home also visited public or private hospitals/clinics. In regression, home is my compersion group (0). In the regression results, the private category is completely omitted. I do not understand where I have made the mistake. I have made changes in my codes but the problem does not resolve. The coding commands are as below. I can not understand where I am going wrong or what mistakes I have made in any way. Can you kindly help me in pointing out my mistake as well as help me with my codes? I really appreciate your help in this crucial time of mine.
Thank you
Aamna
HTML Code:
**Ownership of Facilities (m57) gen antenatalvisit_facility=0 foreach xvar of varlist m57a m57b m57e m57f m57g m57h m57l m57m m57n m57o m57p m57q m57s m57x{ replace antenatalvisit_facility=. if `xvar'==. } tab antenatalvisit_facility, mi *Antenatal visit by private/govt/other facilities RECODE gen antenatalvisit_public=antenatalvisit_facility label var antenatalvisit_public "Public Facility Used For Antenatal Care Visits During Pregnancy" label values antenatalvisit_public decision foreach xvar of varlist m57e m57f m57g m57l { replace antenatalvisit_public=1 if `xvar'==1 & `xvar'!= . } tab antenatalvisit_public, mi gen antenatalvisit_private=antenatalvisit_facility label var antenatalvisit_private "Private Facility Used For Antenatal Care Visits During Pregnancy" label values antenatalvisit_private decision foreach xvar of varlist m57m m57n m57h m57o m57p m57q m57s m57x{ replace antenatalvisit_private=1 if `xvar'==1 & `xvar'!= . } tab antenatalvisit_private, mi gen antenatalvisit_home=antenatalvisit_facility label var antenatalvisit_home "Home Used For Antenatal Care Visits During Pregnancy" label values antenatalvisit_home decision foreach xvar of varlist m57a m57b { replace antenatalvisit_home=1 if `xvar'==1 & `xvar'!= . } tab antenatalvisit_home, mi gen ownership=. replace ownership=0 if antenatalvisit_home==1 replace ownership=1 if antenatalvisit_public==1 replace ownership=2 if antenatalvisit_private==1 label var ownership "Ownership of Facilities" label values ownership ownership tab ownership, mi
0 Response to Creating One Categorical Variable by Combining 12 Variables
Post a Comment