As others already wrote there is most likely some non-print character in your code that messes things up. It also appears that when you copy/paste this code into the forum then this character gets removed.
In cases like yours first thing I'm often doing is to copy/paste such code or data into Notepad++ and look at it with View / Show Symbol / Show All Characters
I've just run below code without any issues.
data temp;
length icdx1 icdx2 icdx3 $4;
icdx1='G04';
icdx3='G251';
run;
data out;
set temp;
*OTHER NEUROLOGICAL DISEASES;
array xx $ icdx1 icdx2 icdx3;
label ond="Oth neurological";
ond=0;
do over xx;
if xx in: ("B90", "D48", "G04", "G09", "G10", "G11", "G12",
"G13", "G24", "G25", "G26", "G32", "G37", "G51", "G52", "G53",
"G70", "G71", "G72", "G73", "G80", "G81", "G82", "G83", "G90",
"G91", "G93", "G95", "G99", "M47", "Q00", "Q01", "Q02", "Q03",
"Q04", "Q05", "Q06", "Q07", "Q76") then ond = 1;
*Doing exclusions in this way does not work;
if xx in: ("G130", "G131", "G251", "G254", "G256", "G510", "G732", "G733", "G734", "G838") then ond=0;
end;
run;
You will likely also need to amend your code because currently variable ond will get overwritten whenever one of the two conditions are met.
If the value for icdx1 would lead to ond=1 but the value of icdx3 leads to ond=0 then ond will be 0.
... View more