Using a hash table as you asked for could work like below.
As others stated if such a hash approach really helps will depend on your data and especially where it's stored as compared to where SAS executes.
data MASTER;
infile datalines truncover dlm='|' dsd;
input ID Date:ddmmyy. Gender $ Code $ Class $;
format date date9.;
datalines;
1|.|female|AB|LOW
2|.|female|CD|LOW
3|1/1/2021|M|CD|
;
data TRANSACTION;
infile datalines truncover dlm='|' dsd;
input ID Date:ddmmyy. Gender $ Code $ Class $;
format date date9.;
datalines;
1|7/1/2020||EF|
2|7/2/2020|male||
3||male||
;
proc sql;
create view v_transaction as
select
id,
date as _date,
gender as _gender,
code as _code,
class as _class
from transaction
where cmiss(date,gender,code,class) ne 4
;
quit;
data master;
if _n_=1 then
do;
if 0 then set v_transaction;
dcl hash h1(dataset:'v_transaction');
h1.defineKey('id');
h1.defineData(all:'y');
h1.defineDone();
end;
modify master;
if h1.find()=0 then
do;
date=coalesce(_date,date);
gender=coalescec(_gender,gender);
code=coalescec(_code,code);
class=coalescec(_class,class);
replace;
call missing (of _:);
end;
run;
proc print data=master;
run;
... View more