Hi,
probably it's quite simple, but I have been struggling to find the right command.
I have list of individuals who are ranked based on their performance. I would like to group peers based on two conditions. The group should start ones x >5.5s and group other variables which then are x<2s from each other. "difference" variable identify how far individuals are from each other, thus this should be the variable to condition upon. The groups should repeat by raceid.
. list raceid finalrank difference new_group in 1/20
+-----------------------------------------+
| raceid finalr~k differ~e new_gr~p |
|-----------------------------------------|
1. | 36426 1 0:0.0 . |
2. | 36426 2 0:32.2 1 |
3. | 36426 3 0:7.3 2 |
4. | 36426 4 0:6.6 3 |
5. | 36426 5 0:3.7 . |
|-----------------------------------------|
6. | 36426 6 0:6.1 4 |
7. | 36426 7 0:0.2 4 |
8. | 36426 8 0:1.2 4 |
9. | 36426 9 0:3.7 . |
10. | 36426 10 0:0.6 . |
|-----------------------------------------|
11. | 36426 11 0:6.1 5 |
12. | 36426 12 0:0.6 5 |
13. | 36426 13 0:2.7 . |
14. | 36426 14 0:4.4 . |
15. | 36426 15 0:3.0 . |
|-----------------------------------------|
16. | 36426 16 0:0.2 . |
17. | 36426 17 0:5.5 6 |
18. | 36426 18 0:2.9 6 |
19. | 36426 19 0:0.5 6 |
20. | 36426 20 0:0.5 6 |
+-------------
Thank you in advance for any hint!
probably it's quite simple, but I have been struggling to find the right command.
I have list of individuals who are ranked based on their performance. I would like to group peers based on two conditions. The group should start ones x >5.5s and group other variables which then are x<2s from each other. "difference" variable identify how far individuals are from each other, thus this should be the variable to condition upon. The groups should repeat by raceid.
. list raceid finalrank difference new_group in 1/20
+-----------------------------------------+
| raceid finalr~k differ~e new_gr~p |
|-----------------------------------------|
1. | 36426 1 0:0.0 . |
2. | 36426 2 0:32.2 1 |
3. | 36426 3 0:7.3 2 |
4. | 36426 4 0:6.6 3 |
5. | 36426 5 0:3.7 . |
|-----------------------------------------|
6. | 36426 6 0:6.1 4 |
7. | 36426 7 0:0.2 4 |
8. | 36426 8 0:1.2 4 |
9. | 36426 9 0:3.7 . |
10. | 36426 10 0:0.6 . |
|-----------------------------------------|
11. | 36426 11 0:6.1 5 |
12. | 36426 12 0:0.6 5 |
13. | 36426 13 0:2.7 . |
14. | 36426 14 0:4.4 . |
15. | 36426 15 0:3.0 . |
|-----------------------------------------|
16. | 36426 16 0:0.2 . |
17. | 36426 17 0:5.5 6 |
18. | 36426 18 0:2.9 6 |
19. | 36426 19 0:0.5 6 |
20. | 36426 20 0:0.5 6 |
+-------------
Thank you in advance for any hint!

Comment