Hello,
Can anyone clarify on below concern,
"which one is good proc sql sorting or data sorting" ?
Regards,
Jai
"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.
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.
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.
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.
"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.
That was @ballardw 's answer.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.