data a;
input (RecordNo ID1 ID2 ID3) ($);
cards;
001 A001 A112 A511
002 A005 A234 A345
003 A002 A123 A112
004 A003 A004 A234
;
run;
data b;
input (Id Name) ($);
cards;
A001 Rick
A002 David
A003 Ron
A004 Pat
A005 Tom
;
run;
data want;
if _n_=1 then do;
if 0 then set b;
declare hash h(dataset:'b');
h.definekey('id');
h.definedata('name');
h.definedone();
end;
set a;
array x{*} $ 32 name1-name3;
array y{*} $ 32 id1-id3;
do i=1 to dim(x);
call missing(name);
id=y{i};
rc=h.find();
x{i}=name;
end;
drop i id name rc;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.