<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: fast sort with hash object in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/856352#M338363</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3574"&gt;@mariopellegrini&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I didn't find the details option on proc sort, do you mean on proc contents?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's all in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p02bhn81rn4u64n1b6l00ftdnxge.htm" target="_self"&gt;SORT Procedure&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/etlug/4.904/n139ymobeacculn1gnz7q6fyfior.htm" target="_self"&gt;Optimizing Sort Performance&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 22:14:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-01-30T22:14:29Z</dc:date>
    <item>
      <title>fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854270#M337606</link>
      <description>&lt;P&gt;Good morning.&lt;BR /&gt;I would like to get a lower processing time with the use of hashes than the base sas code for a sort operation.&lt;BR /&gt;I have used 2 different hashcodes but the processing times compared to sas base are always higher.&lt;BR /&gt;Someone can help me?&lt;BR /&gt;Here is my example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let righe = 26500000 ;
%let colonne = 10;
data work.tab1 ( keep = keyvar large: ) ;
array keys(1: &amp;amp;colonne) $1 _temporary_;
length keyvar 8;
array largevar [&amp;amp;colonne];
retain largevar 55;
do _i_ = 1 to &amp;amp;righe;
keyvar = ceil (ranuni(1) * &amp;amp;righe);
do j=1 to &amp;amp;colonne;
largevar [j] = floor(round(rand("Uniform")*10,0.01));
end;
output ;
end;
run;&lt;BR /&gt;
/* sort sas */
proc sort data=tab1 out=ok_sort2;
by keyvar largevar1 largevar2 largevar3 ;
run;

/* hash sort 1 */
data ok_sort1;
if 0 then set tab1;
declare hash sortha(dataset: 'tab1', ordered: 'a', multidata:'y');
declare hiter iter('sortha');
rc=sortha.definekey ("keyvar", "largevar1", "largevar2","largevar3");
rc=sortha.defineData("keyvar", "largevar1", "largevar2","largevar3","largevar4","largevar5","largevar6","largevar7","largevar8","largevar9");
rc=sortha.definedone();
do while ( rc = 0 );
rc = iter.prev(); if rc=0 then output ok_sort1;
end;
stop;
run;

/* hash sort 2 */
data _null_;
if 0 then set tab1;
declare hash sortha(dataset: 'tab1', ordered:'d', multidata:'y');
sortha.definekey ("keyvar", "largevar1", "largevar2","largevar3");
sortha.defineData(all:'yes');
sortha.definedone();
sortha.output(dataset:'ok_sort1');
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 06:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854270#M337606</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-01-18T06:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854272#M337608</link>
      <description>&lt;P&gt;The hash object is a great tool for a lot of things. But it is not a replacement for Proc Sort and should not be used for a plain sort operation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your only goal is to decrease run-time of your sort, there are options you can try to tweak and see if it improves your result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the Details Option to get a detailed description of I/O operations of your Proc Sort Step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the step above has a lot of I/O steps, increase the Sortsize Option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps use the Tagsort Option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a detailed list of Proc Sort Options, consult the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0ha9ymifyaqldn14m2xlqw252wa.htm" target="_self"&gt;Proc Sort Documentation&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 07:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854272#M337608</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-01-18T07:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854880#M337884</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;so in general the use of hashes is not useful for proc sort?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 17:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854880#M337884</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-01-20T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854886#M337888</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3574"&gt;@mariopellegrini&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks.&amp;nbsp;so in general the use of hashes is not useful for proc sort?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the sole purpose is to sort data then Proc Sort is way more efficient.&lt;/P&gt;
&lt;P&gt;If part of the hash is to result in sorting as a side effect of other &lt;STRONG&gt;needed&lt;/STRONG&gt; operations then go for it. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 18:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/854886#M337888</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-20T18:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/856252#M338333</link>
      <description>&lt;P&gt;I didn't find the details option on proc sort, do you mean on proc contents?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 14:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/856252#M338333</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-01-30T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: fast sort with hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/856352#M338363</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3574"&gt;@mariopellegrini&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I didn't find the details option on proc sort, do you mean on proc contents?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's all in the documentation.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p02bhn81rn4u64n1b6l00ftdnxge.htm" target="_self"&gt;SORT Procedure&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/etlug/4.904/n139ymobeacculn1gnz7q6fyfior.htm" target="_self"&gt;Optimizing Sort Performance&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 22:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fast-sort-with-hash-object/m-p/856352#M338363</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-30T22:14:29Z</dc:date>
    </item>
  </channel>
</rss>

