I have a large dataset where I want to only keep instances where one variable (frompc) can be matched somewhere within the dataset to another variable (topc) and vice versa where topc can be matched within the dataset to frompc. It is very tedious to do this in excel so i am lookng for a way it can done in SAS, possibly using Proc SQL or merge.
| frompc | topc |
+----------------+--------------+
| F19913344567 | M19800674560 |
| F19232342208 | F19451367689 |
| M20011105436 | F19232342208 |
| F20220054321 | M19762152621 |
In this case i would like rows 2 and 3 kept but rows 1 and 4 removed.
I have tried different forms of SQL but keep getting results that include records that don't match or even excluding records that do match.