I tried the below option. After extracting the data using the above suggested method, I used the matching check the one I posted it initially. This gives the result data WANT; set HAVE; by GROUP TRANSACTION notsorted; where TRANSACTION in (7400,7470,4320); if (last.TRANSACTION and TRANSACTION=7400 and not last.GROUP) or (first.TRANSACTION and TRANSACTION in(7470,4320) and not first.GROUP); run;
... View more