| ID | Event | Code | value |
| 1 | A | ||
| 1 | B | 1 | 6 |
| 1 | B | 1 | 7 |
| 1 | B | 1 | 8 |
| 2 | A | 5 | 7 |
| 2 | B | 6 | 8 |
want
| ID | Event | Code | Value |
| 1 | A | ||
| 1 | B | 1 | 6 |
| 2 | A | 5 | 7 |
| 2 | B | 6 | 8 |
This is just an example, but for my dataset, I need to be able to compare ID and code.
If the ID and code are the same, then I want to only retain one row and delete all the other rows.
Can you please suggest?
Easiest might be
Proc sort data=have out=want nodupkey;
by Id code;
run;
Create a new output data set Want so you don't accidentally delete things you want. This way your original data set remains.
If EVENT plays any role in this process, which you did not mention, then you may want to sort by ID Event Code; Maybe.
Easiest might be
Proc sort data=have out=want nodupkey;
by Id code;
run;
Create a new output data set Want so you don't accidentally delete things you want. This way your original data set remains.
If EVENT plays any role in this process, which you did not mention, then you may want to sort by ID Event Code; Maybe.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.