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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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