Hi all, I have a dataset looks like this: ID Rank1 Rank2 Rank3 Rank4 Rank5 Rank 6 1 3 4 4 3 1 5 2 5 4 3 6 1 2 3 1 6 6 3 6 6 4 5 6 4 1 2 6 5 3 1 3 2 1 6 6 2 3 6 3 4 1 7 6 2 2 2 2 6 8 2 2 1 4 5 5 9 1 2 5 1 1 5 10 1 4 4 1 6 6 The Rank1- Rank6 may contain values from 1-6. So within the same ID, what I want is: 1. Create a flag variable SAME, if there is same value from Rank1-Rank6 for each ID, then SAME=1 otherwise SAME = 0. for example , ID2 doesn't have the same value from Rank1-Rank6, then SAME =0. 2. I want to know how many Ranks are the same as Rank1, Rank2... etc. For example, across total ID, there is 1 Rank2 is the same as Rank1( ID=8), 1 Rank3 is the same as Rank1(ID=5), 3 Rank4 are the same as Rank1 (ID =1,9,10). So the result data will be like this: Rank1 Rank2 Rank3 Rank4 Rank5 Rank6 Rank1 N/A 1 1 3 1 1 Rank2 N/A X X X X Rank3 N/A X X X Rank4 N/A X X Rank5 N/A X Rank6 N/A Thanks for any help!!!
... View more