Filtering for values contained in another dataset is best done with a hash object.
Say you have two datasets "have" and "lookup", both containing a variable "key".
data want;
set have;
if _n_ =1
then do;
declare hash l (dataset:"lookup");
l.definekey("key");
l.definedone();
end;
if l.check() = 0;
run;
... View more