I checked with a colleague who handles the hash object and you can't use a wild card, still there are other ways and this one works.
data have;
length id $10 dcode $48;
input id$ dcode$ &;
datalines;
1 I410 J332
2 C450 I412
3 I413 R789
4 R281 I519
5 O603 C351
6 3456 I510
7 I444 2345
8 I418 6789
9 I509 1234
10 9876 I412
;
run;
data Codes;
length code $4.;
input code $ ;
datalines;
I410
I412
I413
I519
;
run;
data tmp;
set codes;
chk=substr(code,1,3);
run;
DATA Code_scan;
length chk $3.;
if _N_=1 then do;
declare hash P(dataset: 'tmp');
P.defineKey('chk');
P.defineData('chk');
P.defineDone();
end;
set have ;
length Findcode $4;
do i=1 to 30 by 1;
Findcode=substr(scan(Dcode,i,''),1,3);
if Findcode='' then leave;
if P.find(key:Findcode) = 0
then do;
output;
leave;
end;
end;
run;
proc print;run;
... View more