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


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


Tip of the Day:October 8

From sasCommunity
Revision as of 18:29, 5 October 2009 by Frankfry (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

sasCommunity Tip of the Day

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 () ;
   clin.output(dataset:'clinlist');
   stop;
   run;

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

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



Feel free to comment on this tip.


Prior tip - Next tip - Random Tip

Submit a Tip