Help using Base SAS procedures

sort

Accepted Solution Solved
Reply
Contributor
Posts: 70
Accepted Solution

sort

can we do sort operations with out using sort procedure.Is there any another concept.

Thanks in advance

regards

rawindarreddy


Accepted Solutions
Solution
‎03-20-2012 05:02 AM
Super User
Posts: 9,691

sort

How about SQL or Hash Table ?

proc sql;

create table want as

   select * from sashelp.class

     order by name;

quit;

Ksharp

View solution in original post


All Replies
Solution
‎03-20-2012 05:02 AM
Super User
Posts: 9,691

sort

How about SQL or Hash Table ?

proc sql;

create table want as

   select * from sashelp.class

     order by name;

quit;

Ksharp

Respected Advisor
Posts: 3,124

sort

Following Ksharp's suggestion, an example of hash() solution on sorting:

data have;

input a;

cards;

10

1

3

2

5

7

4

3

;

data _null_;

   if _n_=1 then do;

       set have (obs=1);

       dcl hash h(dataset: 'have',ordered:'a', multidata: 'yes');

h.definekey('a');

h.definedata('a');

h.definedone();

    end;

h.output(dataset:'want');

run;

proc print;run;

Contributor
Posts: 70

sort

thanks Haikuo but i dont know Hash concept can you help me to understand what is hash

Respected Advisor
Posts: 3,124

sort

Do a googling on 'SAS Hash', you will find tons of sugi papers on this topic, that is at least how I started. Plus SAS online documentation and practice, you will have a taste of it before you know it.

Regards,

Haikuo

Contributor
Posts: 70

sort

thanks ksharp i know about this iam looking for sas/base concept.Can you help me how could we do that using hash table and what is a hash concept

Trusted Advisor
Posts: 2,113

sort

Another possibility is to have the PROC SORT procedure use another sort tool.  A lot of mainframe shops do that with SyncSort.

For some actities, you can use PROC FORMAT to accomplish the goal of a SORT.

Note that all of these procedures may give you different results when there are ties on the sort keys.

This paper may be helpful

http://support.sas.com/resources/papers/proceedings10/140-2010.pdf

Doc Muhlbaier

Duke

Super User
Posts: 10,550

sort

If you don't need all of the data , depending on your needs several procs such as FREQ, MEANS or SUMMARY using class variables, and TABULATE will produce sorted output and output datasets.

Frequent Contributor
Posts: 138

sort

Proc sql, Hash method, proc format are some of various ways

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 231 views
  • 0 likes
  • 6 in conversation