proc sql;
create table new as
select *
from key_table as a left join table as b
on a.id=b.ida;
quit;
data new;
set new;
if ida eq ' ' then idx=id;else idx=idb;
keep id ida idx;
run;
我建议先把 ida idb 处理下 ida 取长度最小的 idb取nodupkey的 比如这样
ida idb
工行 中国工商银行
农行 中国农业银行
建行 中国建设银行
if prxmatch("/.+?工.+?行.+?/",id) then idx='中国工商银行';
else if prxmatch("/.+?农.+?行.+?/",id) then idx='中国农业银行';
elss if prxmatch("/.+?建.+?行.+?/",id) then idx='中国建设银行';
else idx='NA';