PROC SORT sorts the data set by
Gender. This is required to obtain a separate set of ranks for each group.
proc sort data=swim out=pairs;
   by gender;
run;