Hi SAS Users, My question seems fairly simple to describe but I have been unable to find an answer to it. I'm hoping someone can help. I have a dataset which contains two fields: field1: 1 2 3 4 5 6 7 field2: a a b b b c d I want to create an output table that: a) firstly, identifies which rows in field1 have duplicate field2 values. So these would be 1, 2, 3, 4 and 5. b) retrieves the value of the duplicate field1 value for each relevant row. So for row 1, the new field3 column should have '2', for row 2 field3 should have '1', etc. c) contains only one record in each duplicate flag field. So for rows 1 and 2, only one new field (field3) is required (because there is only one duplicate). However, for rows 3, 4 and 5, because these are all duplicates, two duplicate fields are required (field3 would have '4' in it for row 3 and field4 would have '5' in it for row 3. I understand there are a range of different ways this type of flagging could be presented. I am not wedded to the visualisation described above, and if it could be done more easily/simply by displaying all duplicates in a single field3, separated by commas or extending the length of the table to have a different row for each different pair of duplicates, I would appreciate being able to test the code. Effectively, this is going further than the simple 'count' flag in that instead of having field3 show only '2', '3', etc. (denoting the quantity of duplicate records), the flag fields should list the actual records which are duplicated. Best regards Luke
... View more