I have about 200,000 records of cases and I want to identify the true consecutive Negative result (can't have Positive result after it). Here's some examples: A: Keep only the result after first two positive (Obs 3-5) B: Obs 6-7 need to be drop because these is a Positive after these Negative. C: Need to be drop 😧 Only 15-17 can be keep since 13 have Positive after them as well. The basic concept is to keep the Negative results after the last positive for each case (group?) and give them a seq# if possible. Thank you so much for your help. I tried to add seq# but many times it starting with 2 or even 4 when I use if first.Case then Seq+1; Obs Case Test Date Test Result Record Wanted Seq# 1 A 01/01/2020 Missing 2 A 01/02/2021 Positive 3 A 01/03/2021 Negative V 1 4 A 01/04/2021 Negative V 2 5 A 01/05/2021 Negative V 3 6 B 01/01/2020 Negative 7 B 01/02/2021 Negative 8 B 01/03/2021 Positive 9 C 01/02/2021 Missing 10 D 01/01/2020 Positive 11 D 01/02/2021 Positive 12 D 01/03/2021 Missing 13 D 01/04/2021 Negative 14 D 01/01/2021 Positive 15 D 01/02/2022 Negative V 1 16 D 01/03/2022 Negative V 2 17 D 01/04/2022 Negative V 3
... View more