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

Hello,

 

 

Can anyone clarify on below concern,

 

"which one is good proc sql sorting or data sorting" ?

 

 

Regards,

Jai

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

"Apples and oranges."--Brilliant analogy. 

 

Beautifully explained with so much eloquence. First class!-->"If the ONLY operation being done on a data set Proc sort will usually be significantly faster.

If you actually doing what proc sql is designed for such as combining data sets such as joins and creating new variables, summarizing data or other manipulations then that is something that Proc sort doesn't do. So Sort would not be a valid option"

 

That's incredibly thorough. 

 

 


@ballardw wrote:

Apples and oranges.

 

Proc sort has options to use different sort (collation) sequences, remove duplicate keys or observations to a separate output data set, prevent changing modified date on existing data, remove unique sort keys (only one record) and send those removed records to yet another data set.

 

If the ONLY operation being done on a data set Proc sort will usually be significantly faster.

 

If you actually doing what proc sql is designed for such as combining data sets such as joins and creating new variables, summarizind data or other manipulations then that is something that Proc sort doesn't do. So Sort would not be a valid option.


 

View solution in original post

6 REPLIES 6
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

SQL order by will have advantages as noted in this link

https://communities.sas.com/t5/SAS-Communities-Library/Custom-Sorting-with-Proc-SQL/ta-p/373460

normally straight ascending or descending sorts will give you what you want but just occasionally you will come up against a scenario where they won’t. In these cases, the flexibility afforded by the Proc SQL Order By clause can come to the rescue and turn what seems like a complex problem into something quite straightforward.

PeterClemmensen
Tourmaline | Level 20

Both good. Which one to use depends largely on the specific situation. You have to be more specific about your needs for us to give a more usable answer.

ballardw
Super User

Apples and oranges.

 

Proc sort has options to use different sort (collation) sequences, remove duplicate keys or observations to a separate output data set, prevent changing modified date on existing data, remove unique sort keys (only one record) and send those removed records to yet another data set.

 

If the ONLY operation being done on a data set Proc sort will usually be significantly faster.

 

If you actually doing what proc sql is designed for such as combining data sets such as joins and creating new variables, summarizind data or other manipulations then that is something that Proc sort doesn't do. So Sort would not be a valid option.

novinosrin
Tourmaline | Level 20

"Apples and oranges."--Brilliant analogy. 

 

Beautifully explained with so much eloquence. First class!-->"If the ONLY operation being done on a data set Proc sort will usually be significantly faster.

If you actually doing what proc sql is designed for such as combining data sets such as joins and creating new variables, summarizing data or other manipulations then that is something that Proc sort doesn't do. So Sort would not be a valid option"

 

That's incredibly thorough. 

 

 


@ballardw wrote:

Apples and oranges.

 

Proc sort has options to use different sort (collation) sequences, remove duplicate keys or observations to a separate output data set, prevent changing modified date on existing data, remove unique sort keys (only one record) and send those removed records to yet another data set.

 

If the ONLY operation being done on a data set Proc sort will usually be significantly faster.

 

If you actually doing what proc sql is designed for such as combining data sets such as joins and creating new variables, summarizind data or other manipulations then that is something that Proc sort doesn't do. So Sort would not be a valid option.


 

jaiganesh
Obsidian | Level 7
Thanks for fast and comprehensive reply.
novinosrin
Tourmaline | Level 20

That was @ballardw  's answer. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 821 views
  • 5 likes
  • 5 in conversation