BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rawindar
Calcite | Level 5

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

Thanks in advance

regards

rawindarreddy

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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

8 REPLIES 8
Ksharp
Super User

How about SQL or Hash Table ?

proc sql;

create table want as

   select * from sashelp.class

     order by name;

quit;

Ksharp

Haikuo
Onyx | Level 15

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;

rawindar
Calcite | Level 5

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

Haikuo
Onyx | Level 15

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

rawindar
Calcite | Level 5

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

Doc_Duke
Rhodochrosite | Level 12

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

ballardw
Super User

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.

manojinpec
Obsidian | Level 7

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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