08-25-2015 04:13 PM
How do I re-write this code:
if var in ('1', '2', '3') then delete;
I need the '1','2','3' to be in a permanent file/table, so that the "var" can reference a column in the file and execute the command (ie I don't want 1,2,3 to show on my SAS code.
08-28-2015 10:42 AM
This is my idea more precisely. M.Johnson is correct: Many ways to skin this cat.
08-28-2015 10:16 AM
I'm sure there are plenty of ways, here is one:
create table want as
where var not in (
select var from ref);
08-28-2015 01:47 PM
Here is yet another way to skin the cat. This one uses SAS' hash object. In my experience, the hash object is versatile for a fairly wide variety of lookups, unless the lookup table is excessively large and/or the lookup keys are very very long character variables.
I have reused PhilC's sample datasets "a" and "b".
data a (index=(x));
input x y;
length rc 8 found $3;
/* use a SAS hash object to do the lookup; it is fast for most tasks! */
if _n_ = 1 then do;
declare hash t(dataset: 'a');
if rc=0 then found='Y';
put "value x=" x " not found in the lookup table!!";