As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Use The HASH Object to Sort Your Data

From sasCommunity
Jump to: navigation, search

The DATA step component HASH object can be used in a variety of ways to efficiently handle large data sets. Although one of the simpler uses is to sort data sets, this is not necessarily a more efficient approach than using PROC SORT.

The following DATA step creates a sorted data set with unique keys.

data _null_;
   if 0 then set advrpt.demog(keep=clinnum subject lname fname dob);
   declare hash clin (dataset:'advrpt.demog', ordered:'Y') ;
      clin.definekey ('clinnum','subject');
      clin.definedata ('clinnum','subject','lname','fname','dob') ;
      clin.definedone () ;

Limitations of sorting using the Hash object have been discussed on SAS-L.

Submitted by Art Carpenter. Contact me at my Discussion Page. more