Based on that A is your lookup table
data new_test1(drop=rc r);
if 0 then set a;
declare hash hh_pat(dataset:"a", multidata: "y");
rc=hh_pat.defineKey("key");
rc=hh_pat.defineData("d1", "d2", "d3");
rc=hh_pat.defineDone();
do until(eof);
set b end=eof;
call missing(d1, d2, d3);
rc=hh_pat.find();
output;
if (rc = 0) then do;
hh_pat.has_next(result: r);
do while(r ne 0);
hh_pat.find_next();
output;
hh_pat.has_next(result: r);
end;
end;
end;
stop;
run;
That should be identical to
proc sql ;
select b.key, a.d1, a.d2, a.d3 , b.d4, b.d5 , b.d6
from b left join a
on b.key=a.key;
quit;
... View more