Here is a FCMP based Quick Sort Routine just for your reference.
proc fcmp outlib = work.cmpar.lib;
subroutine qsort(v[*], left, right);
outargs v;
if left >= right then return;
call swap(v, left, ceil((left + right) / 2));
last = left;
do i = left to right;
if v[i] < v[left] then call swap(v, last, i);
end;
call swap(v, left, last);
call qsort(v, left, last - 1);
call qsort(v, last + 1, right);
endsub;
subroutine swap(v[*], i, j);
outargs v;
temp = v[i];
v[i] = v[j];
v[j] = temp;
endsub;
quit;
options cmplib = work.cmpar;
/* Sort values from 2 to end of the Array k[*] */
data _null_;
array k[5] _temporary_ (100, 2, 70, 12, 50);
call qsort(k, 2, dim(k));
SORTED = catq('d',' ', of k[*]);
put SORTED =; /* SORTED=100 2 12 50 70 */
run;
... View more