Hi Shmuel I was so excited and accepted your solution too soon. When I tried to run it it gives me this error: 12813 data want3; 12814 set have; 12815 array idx $ id1-id3; /* original data */ 12816 12817 /* assuming ID is the last of valid IDs */ 12818 do i=1 to 3; 12819 idx(i) = upcase(idx(i)); /* ensure capital K */ 12820 if substr(idx(i),1,1) = 'K' and length(compress(idx(i),'K',kd) = 8 ------ 72 12821 then id = idx(i); ---- - 388 79 202 ERROR 72-185: The LENGTH function call has too many arguments. ERROR 388-185: Expecting an arithmetic operator. ERROR 79-322: Expecting a ). ERROR 202-322: The option or parameter is not recognized and will be ignored. 12822 end; 12823 run; Now as you see that I have one more comment that I did not make clear... If I have in ID1: KO3524846 (letter O instead of number 0) but nothing on ID2 and ID3 how I can include in the code a correction of ID1 to K03524846 (all numbers) If I have ID1:K03508960 (good format) and different ID2:K03339796 (good also format) how I can include in the code to take ID1 as correct? I attach the table here again with those two revised examples:
... View more