Hi,

I have a dataset containing one variable identifying study participants and 30 variables containing ICD-codes (one per variable, strings). I need to identify every code indicating diabetes and generate a new variable, coded as 1 or 0 to indicate the presence or absence of diabetes. Of course I can write gen diabetes==1 if var1=="xxx" etc and repeat this up to var30. Alas there are quite a lot of different ICD-codes for diabetes so it would take a lot of time. Does anyone know of a faster way?

Best wishes,

David