NIS has 40 Diagnoses (dx1 to dx40) listed for every patient. I am trying to find how many have diabetes. There are a lot of ICD10CM codes for diabetes between E0800 to E1399.
I have written this

gen diabetes = 0
foreach var of varlist dx1-dx40 {
replace diabetes=1 if `var'=="E0800"
replace diabetes=1 if `var'=="E0801"
replace diabetes=1 if `var'=="E0802"
replace diabetes=1 if `var'=="E0803"
....

}

but it will take an hour to write in all the diagnoses codes.. is there anything simpler?