I feel like I'm not clever enough to figure out a solution to my problem this morning (time for more coffee!). Here it is:
I have two columns of data, one with an ID number, and the second with a status code. There are four different possible codes, each with a different priority. When a more complete code is reached, the others are not deleted, so there may be multiple rows belonging to a single ID number. What I'd like to do is have a program delete duplicates according to the priority of their status. For example:
Column1 Column2
1.................D
1.................C
1.................B
2.................D
2.................C
3.................D
3.................D
3.................C
3.................A
4.................D
5.................D
5.................C
So in this case, the patient ID numbers would be in Column 1, numbered 1-5. The status codes would be D, C, B, and A. Code A and B actually have the same priority, and no patient will have both A and B listed (only one or the other).
Ideally, I'd like the code to go through each patient ID and remove every row except the one with the highest priority.
What should I do?
Thank you!!
I have two columns of data, one with an ID number, and the second with a status code. There are four different possible codes, each with a different priority. When a more complete code is reached, the others are not deleted, so there may be multiple rows belonging to a single ID number. What I'd like to do is have a program delete duplicates according to the priority of their status. For example:
Column1 Column2
1.................D
1.................C
1.................B
2.................D
2.................C
3.................D
3.................D
3.................C
3.................A
4.................D
5.................D
5.................C
So in this case, the patient ID numbers would be in Column 1, numbered 1-5. The status codes would be D, C, B, and A. Code A and B actually have the same priority, and no patient will have both A and B listed (only one or the other).
Ideally, I'd like the code to go through each patient ID and remove every row except the one with the highest priority.
What should I do?
Thank you!!