/***************************************************************************************************************** SAS file name: Three_Sort_Alternatives File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate three alternativesto the PROC SORT Procedure in SAS Author: Peter Clemmensen Creation Date: 18/01/2018 This program supports the example page "Three Alternatives To PROC SORT In SAS" on SASnrd.com *****************************************************************************************************************/ proc sort data=sashelp.class out=ProcSort; by name; run; /* 1: PROC SQL Order By Clause */ proc sql noprint; create table SortSQL as select * from sashelp.class order by name; quit; /* 2: Hash Object Sort*/ data _null_; if 0 then set sashelp.class; declare hash h(dataset:"sashelp.class", multidata:"Y", ordered:"Y"); h.definekey("name"); h.definedata(all:"Y"); h.definedone(); h.output(dataset:"SortHash"); run; /* 3: Index Sort*/ proc copy in=sashelp out=work memtype=data; select class; run; proc datasets library=work nolist; modify class; index delete _all_; index create name; run;quit; data SortIndex; set class; by name; run;