I am performing a study looking at surgical outcomes. I have created many categories which describe the main indication for surgery. each category is dichotomous.
I want to create an 'Other indication' category to identify patients who did not have a listed indication for surgery.
I have a list of 14 different categories for surgery listed: indi_cd1 to indi_cd13, and categories that i coded as follows: ind_matreq ind_macro etc.... These categories all have an 'ind_' prefix.
Im trying to use loops to avoid creating a long list to code for patients with other surgical indications using replace.
However, im having problems.
Here's my code which is not working for me.
foreach i in IUGR matreq anomaly oligo PPROM vagbleed uterine fibroid HELLP{
forvalues j =0/13{
replace ind_other=1 if ind_`i' !=1 & indi_cd`j' !=1
}
}
Any help that folks can provide would be really appreciated.
Thanks,
Alex Butwick
I want to create an 'Other indication' category to identify patients who did not have a listed indication for surgery.
I have a list of 14 different categories for surgery listed: indi_cd1 to indi_cd13, and categories that i coded as follows: ind_matreq ind_macro etc.... These categories all have an 'ind_' prefix.
Im trying to use loops to avoid creating a long list to code for patients with other surgical indications using replace.
However, im having problems.
Here's my code which is not working for me.
foreach i in IUGR matreq anomaly oligo PPROM vagbleed uterine fibroid HELLP{
forvalues j =0/13{
replace ind_other=1 if ind_`i' !=1 & indi_cd`j' !=1
}
}
Any help that folks can provide would be really appreciated.
Thanks,
Alex Butwick