First of all: do NOT use Excel for anything that is supposed to be a reliable solution. DON'T.
Use a DATA step with DATALINES instead:
data lookup;
input ID $ COUNT TYPE $;
datalines;
1 2 A
1 3 B
2 1 C
;
Now, suppose you have a dataset like this:
data have;
input ID $ COUNT TYPE $;
datalines;
1 2 A
1 2 Z
1 3 B
1 3 Y
2 1 C
2 2 C
;
you can use a hash object to do your subset:
data want;
set have;
if _n_ = 1
then do;
declare hash l (dataset:"lookup");
l.definekey("ID","COUNT","TYPE");
l.definedone();
end;
if l.check() = 0;
run;
... View more