Just for the record, I finally had time to test this approach. It works fine, except for one major drawback. SAS objects to: declare hash h(dataset: 'have (rename=(n2=n1 n1=n2))'); It will perform the same loading just fine if I go through an extra step just to copy over the data set. Here is what worked: data have; input n1 $ n2 $ amount; cards; a b 1 a b 2 b a 3 a c 4 c d 5 ; data stupid; set have; drop amount; rename n1=n2 n2=n1; run; data want; if _n_=1 then do; if 0 then set have (keep=n1 n2); * declare hash h(dataset:'have (rename=(n1=n2 n2=n1))'); declare hash h (dataset: 'stupid'); h.definekey('n1', 'n2'); h.definedone(); end; set have; if h.check()=0 and n1 > n2 then delete; run; A few notes: 1. Duplicates in the data set used to create the hash table are permitted ... and by default are ignored. That's not an issue here ... we only need to identify all the existing combinations of n1 and n2. 2. There was no problem creating a hash table with keys only and no data elements. 3. Reversing the names before loading the keys seems like an interesting way to approach the problem. The CHECK method is then able to find out whether the reverse order ever appeared in the original data. However, it is still necessary to look for a second condition such as n1 > n2. If you don't do that, then the program would remove both sides of the matched pairs (in this case, would remove all the 'a b' records as well as the 'b a' records).
... View more