I need a way to check to see if a value is found e.g., 'Error', and if found then I need to group based on another value. I need to look for Value 3 and if value 3 is found then I need to group and tag all the rows with the same ID and Value1.
Note: I am working in SAS.
Please see the following table:
|id|Value1|Value2 |Value3
|--| --- | --- | ---
|1 | Sta |sta@example.com |Error
|2 |Danny |dany@example.com|
|3 |Elle |elle@example.com|18
|1 | Sta |sta@example.com |55
|2 |Danny |dany@example.com|
|3 |Elle |elle@example.com|Error
|1 | Sta |sta@example.com |67
|1 | Sta |sta@example.com |57
|3 |Elle |elle@example.com|12
|3 |Elle |elle@example.com|15
|3 |Elle |elle@example.com|12
I need to turn the above table into this:
|id|Value1|Value2 |Value3
|--| --- | --- | ---
|1 | Sta |sta@example.com |Error
|2 |Danny |dany@example.com|NoError
|3 |Elle |elle@example.com|Error
I've tried case when and then grouping by ID, but no luck. Any help would be greatly appreciated. Cheers.