Drop observations once condition is met by multiple variables
问题 I have the following data and used one of the existing answered questions to solve my data problem but could not get what I want. Here is what I have in my data Amt1 is populated when the Evt_type is Fee Amt2 is populated when the Evt_type is REF1/REF2 I don't want to display any observations after the last Flag='Y' If there is no Flag='Y' then I want all the observations for that id (e.g. id=102) I want to display if the next row for that id is a Fee followed by REF1/REF2 after flag='Y' (e.g