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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: