Hi: I know there has already been a lot of questions and answers about the ' invalid numeric data error' out there, but after browsing it seems that I can't find one similar to the problem that I encounter. I have a bunch of very similar character variables (e.g. study1 - study 40), and I am trying to use a do loop together with array to recode the 40 variables into 40 new variables called type1-type40. Here is my code: data want; set have; array experiment{40} study1-study40; array type {40}; do i=1 to 40; if experiment{i} in ('106','112','123','133','135','139'')then type{i}=1; else if experiment{i} in ('103 - PartA','103 - PartB', '109 - PartA','109 - PartB','126 - PartA','126 - PartB') then type{i}=2; else if experiment{i}=. then type{i}=.; else if experiment{i}='Ethics train' then type{i}=.; else type{i}=0; end; run; Here is the error message that I keep getting: NOTE: Invalid numeric data, 'Ethics train' , at line 1397 column 13. I have double checked using proc contents, that all study1-study40 variables are characters. I don't know where the error message comes from. Thank you very much! Cici
... View more