proc sql;
create table want as
select id, ifc(max(indexw(put(b.MM_2,best12.),put(id,best12.))>0),'Y','N') as MM_Flag,ifc(max(indexw(put(b.LL_1,best12.),put(id,best12.))>0),'Y','N') as LL_Flag
from main a,BOOK11 b
group by id;
quit;
ERROR: Numeric format BEST in PUT function requires a numeric argument.
ERROR: Numeric format BEST in PUT function requires a numeric argument.
ERROR: Numeric format BEST in PUT function requires a numeric argument.
ERROR: Numeric format BEST in PUT function requires a numeric argument.
So way back in message 9 of this thread, you replied to me, but this is not my code. So that's why I was very unclear about what you were saying.
data WORK.main;
infile datalines dsd truncover;
input ID:BEST12.;
datalines4;
111
134
122
221
232
198
908
762
212
2122
3435
2123
;;;;
data WORK.BOOK11;
infile datalines dsd truncover;
input LL_1:BEST12. MM_2:BEST12.;
datalines4;
111,908
134,762
122,212
221,
232,
198,
;;;;
data want;
if _n_=1 then do;
if 0 then set book11;
declare hash L(dataset:'book11(keep=LL_1 where=(LL_1 is not missing))');
L.definekey('LL_1');
L.definedone();
declare hash M(dataset:'book11(keep=MM_2 where=(MM_2 is not missing))');
M.definekey('MM_2');
M.definedone();
end;
set main;
if L.check(key:id)=0 then LL_Flag='Y';else LL_Flag='N';
if M.check(key:id)=0 then MM_Flag='Y';else MM_Flag='N';
drop LL_1 MM_2;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.