I am trying to get get the study population with certain cancer diagnoses (ICD10 codes) admitted as one of the diagnoses out of 30-40 Dx given in NIS. What code should I use? I have used this following, but it hasn't worked. Note abc/xyz I am just using as an example here for ICD codes range, i.e., 10-20

gen cancer = 0
forv i=1/30 {
replace cancer = 1 if I10_DX`i'>= "abc" & I10_DX`i'<="xyz".}

Can someone help, please?