<?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: Hash sort in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261095#M50740</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;, I am not aware of such an implemenation of Hash object&amp;nbsp;in SAS 9.4. So you are correct, the option will apply to ALL keys.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Haikuo&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2016 14:15:01 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2016-04-04T14:15:01Z</dc:date>
    <item>
      <title>Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/260998#M50703</link>
      <description>&lt;P&gt;I’d like to sort a dataset tab1 by ch, but I do not get&amp;nbsp;the expected result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; tab1;&lt;/P&gt;
&lt;P&gt;input ch:$30. val1:&lt;STRONG&gt;8.&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;D 9&lt;/P&gt;
&lt;P&gt;B 1&lt;/P&gt;
&lt;P&gt;A 6&lt;/P&gt;
&lt;P&gt;C 7&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; tab1_sort;&lt;/P&gt;
&lt;P&gt;if &lt;STRONG&gt;0&lt;/STRONG&gt; then set tab1;&lt;/P&gt;
&lt;P&gt;declare hash sortha(dataset: 'tab1', ordered='d', multidata='y');&lt;/P&gt;
&lt;P&gt;declare hiter iter('sortha');&lt;/P&gt;
&lt;P&gt;rc=sortha.definekey ("ch" );&lt;/P&gt;
&lt;P&gt;rc=sortha.defineData("ch", "val1");&lt;/P&gt;
&lt;P&gt;rc=sortha.definedone();&lt;/P&gt;
&lt;P&gt;do while ( rc = &lt;STRONG&gt;0&lt;/STRONG&gt; );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; rc = iter.prev(); if rc=&lt;STRONG&gt;0&lt;/STRONG&gt; then output tab1_sort;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’d like to obtain the same result from the following proc sort:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=tab1 out=tab1_sort;&lt;/P&gt;
&lt;P&gt;by ch;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 07:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/260998#M50703</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2016-04-04T07:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261000#M50705</link>
      <description>&lt;P&gt;Look at your log. You get WARNINGs in the &lt;FONT face="courier new,courier"&gt;declare hash&lt;/FONT&gt; statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: replace the equal signs with colons.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 07:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261000#M50705</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-04T07:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261007#M50708</link>
      <description>&lt;P&gt;Erm, why not use the proc sort then, that is what its for and any code you write will be slower/less resource friendly?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 08:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261007#M50708</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-04T08:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261073#M50729</link>
      <description>&lt;P&gt;Also, in your Hash code, you specified &lt;FONT color="#000000" size="2"&gt;ordered='d'; &lt;FONT size="3"&gt;however, I couldn't find the equivalent settings in your Proc Sort, as the default is 'ascend'. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 13:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261073#M50729</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-04-04T13:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261092#M50738</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4877"&gt;@Haikuo﻿&lt;/a&gt;&amp;nbsp;Using a HASH to sort it appears that ordering is applied to all keys and cannot duplicate PROC SORT exactly where any KEY may have a different descending/ascending option. &amp;nbsp;Do you know if each key variable's order can be specified using HASH.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 14:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261092#M50738</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-04-04T14:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261093#M50739</link>
      <description>&lt;P&gt;Would OUTPUT method be easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tab1;
   input ch:$30. val1:8.;
   datalines;
D 9
D 8
B 1
A 6
C 7&lt;BR /&gt;;;;;
   run;
 
data _null_;
   if 0 then set tab1;
   declare hash sortha(dataset: 'tab1', ordered:'d', multidata&amp;amp;colon;'y');
   sortha.definekey ("ch" );
   sortha.defineData(all:'yes');
   sortha.definedone();
   sortha.output(dataset:'tab1_sort');
   stop;
   run;
proc sort data=tab1 out=tab2_sort;
   by descending ch;
   run;
proc compare base=tab1_sort compre=tab2_sort listequalvars;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2016 14:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261093#M50739</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-04-04T14:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hash sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261095#M50740</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;, I am not aware of such an implemenation of Hash object&amp;nbsp;in SAS 9.4. So you are correct, the option will apply to ALL keys.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Haikuo&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 14:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-sort/m-p/261095#M50740</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-04-04T14:15:01Z</dc:date>
    </item>
  </channel>
</rss>

