Returns one-based ranks in reverse scan order. Within each group, the first
line according to the scan order receives the group size, and the last line
receives 1.
Examples
table T = with
[| as N |]
[| 10 |]
[| 5 |]
[| 7 |]
T.Rk = rankrev() scan T.N
show table "Reverse rank" with
T.N
T.Rk
This outputs the following table:
N
Rk
10
1
5
3
7
2
Remarks
The scan option is required. The by option restarts the reverse ranking in
each group. When scan values are tied, their relative ranks are arbitrary.
Ranks are consecutive for groups containing at most 16,777,216 lines. Above
that size, the number type cannot represent every integer, and rankrev can
return repeated or rounded ranks.