would need to have been written with more code using SUBSTR as: if substr(diag,1,4) in ("3466", "3623") or substr(diag,1,3) in ("431", "432", "433", "434", "436") then cve_flag = 1; The SAS colon modifier is also useful when looking for ranges of diagnosis code ...