I am trying to use an array to tag various diagnosis variables, but only need the first part of the value to do the tagging. All my variables are in CHAR format. I am trying to use the substring function within the array, but it is running into some errors. Some values of the diag code are V1234, 25011, or 41402. I only need to tag values based on the first three character values: V12, 250, 414. data want; set have; Label diag_tag = "diagnosis tag"; array D_DIAG {8} diag_2 - diag_9; do i = 1 to 8; if substr(d_diag,1,3) = "V12" then diag_tag = 1 ; end; if diag_tag = "" then diag_tag = 0; run;
... View more