If you are looking for a data-only solution, you can do the work PROC SORT
with a hash table. The caveat is that this requires enough memory.
If you want to make simple sorting, you load the hash table using the option ordered:'yes'
and display it in a new table. By default, ordered:yes
sorts data in ascending order. You can also specify descending
.
Easy sorting
data _null_;
if(0) then set sashelp.class;
dcl hash sortit(dataset:'sashelp.class', ordered:'yes', multidata:'yes');
sortit.defineKey('Height'); * Order by height;
sortit.defineData(all:'yes'); * Keep all variables in the output dataset;
sortit.defineDone();
sortit.Output(dataset:'class_sorted');
run;
De-scoring
, , multidata
. (8, 9) (15, 16) . 9 16 .
data _null_;
if(0) then set sashelp.class;
dcl hash sortit(dataset:'sashelp.class', ordered:'yes');
sortit.defineKey('Height'); * Order by height;
sortit.defineData(all:'yes'); * Keep all variables in the output dataset;
sortit.defineDone();
sortit.Output(dataset:'class_sorted');
run;