Your syntax error (you should really show us the log when error(s) appear) is most likely because on the first line of code, you set CODCd to be character; and then on later lines you set it numeric. It can't be both, you have to pick one or the other. I would make the first line
If MISSING(ICD10) = 1 then CODCd = .;
and now they're all numeric.
As far as ICD10 codes are concerned, I think this has all been worked out many times here in the forums and elsewhere, and you shouldn't really have to write your own code ... but as I don't personally get involved in work that uses medical codes, I can't help further, but your favorite internet search engine probably can.
Lastly, I urge you to look carefully at the codes involved, where you say
"Create values based on ICD10 as:
1 (I25.XX), 2 (I50.XX), 3 (I63.XX), and 4 (Other)"
look very very carefully ... the character immediately to the left of 25.XX is not a 1, so when you are testing if something equals 125, I don't think there are ICD10 codes that begin with 125. If it was a 1, then simple rounding down of the decimal to the nearest integer less than or equal to the 125.xx would be dandy, and simple to program ... but it's not a 1.
--
Paige Miller