Hi, I'm relatively new to SAS and I'm struggling with determining the first and last values in a group if they are different from each other. I have brought the data to this form and I need to keep only those values whose first ID value is equal to B while the second is equal to A. According to this, in the following example, only two groups should remain. Unfortunately with proc sql the condition with if first. and last. then is not working. Does anyone have any ideas? Date ID Group 06JUL2022:17:56:14 B X/27580 04OCT2022:00:08:25 B X/27580 02JAN2023:17:01:33 A X/27580 02AUG2022:12:29:01 B X/27581 04OCT2022:00:05:16 A X/27581 02JAN2023:16:52:33 B X/27581 06JUL2022:17:54:43 A X/27582 27JUL2022:12:59:25 B X/27582 02AUG2022:12:21:25 B X/27582 04AUG2022:14:56:26 A X/27582 04OCT2022:00:05:16 B X/27582 06JUL2022:18:16:03 B X/27583 25JUL2022:14:31:08 B X/27583 09AUG2022:14:15:41 B X/27583 23AUG2022:11:34:58 A X/27583 04OCT2022:00:01:15 B X/27583 02JAN2023:19:10:10 A X/27583
... View more