When data are already ordered, rather than re-merge or transpose I prefer a parallel pass in (this case) ID by- group. The first pass collects the criteria that are applied on the second pass. Data selected ; Set have(in= a) have(in=b) ; By ID ; If first.id then do ; Retain flag1-flag3 counter1-counter3 ; Call missing( of flag1-flag3, of counter1-counter3).; IF A then do ; " update counters if appropriate ; * check if criteria apply and set flags ; End ; If ( criteria are right ) then output ; Run;
... View more