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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.