<?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: code optimization with hashes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861476#M340299</link>
    <description>&lt;P&gt;How large is your real dataset (number of observations, observation size)?&lt;/P&gt;
&lt;P&gt;How long do your steps take in real life?&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2023 16:06:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-02-28T16:06:06Z</dc:date>
    <item>
      <title>code optimization with hashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861405#M340271</link>
      <description>&lt;P&gt;Good morning everyone. I'm trying to optimize some time consuming code, I'm asking for suggestions. Starting from a typical situation that I report in the example code below, it is a matter of identifying through sort + data step with the use of by of the records, I was wondering if with hash techniques there is the possibility of improving the processing time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds_1;
input cod1 cod2;
datalines;
1 4
1 12
1 7
2 7
2 6
2 9
3 12
3 4
;
proc sort data=ds_1;
by cod1 cod2;
run;

data ds_2;
set ds_1;
by cod1 cod2;
if last.cod1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861405#M340271</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-02-28T14:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: code optimization with hashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861476#M340299</link>
      <description>&lt;P&gt;How large is your real dataset (number of observations, observation size)?&lt;/P&gt;
&lt;P&gt;How long do your steps take in real life?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861476#M340299</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-28T16:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: code optimization with hashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861511#M340313</link>
      <description>&lt;P&gt;&lt;FONT style="vertical-align: inherit;"&gt;&lt;FONT style="vertical-align: inherit;"&gt;35,800,340 observations and 11 variables in total (8 variables in the "by")&lt;BR /&gt;The original date step lasts:&lt;BR /&gt;real time 5:38.72&lt;BR /&gt;cpu time 5:10.59&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 17:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861511#M340313</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-02-28T17:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: code optimization with hashes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861541#M340326</link>
      <description>&lt;P&gt;If your initial dataset is already sorted by cod1, you could avoid the PROC SORT by using a DOW loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until (last.cod1);
  set have;
  by cod1;
  _cod2 = max(_cod2,cod2);
end;
do until (last.cod1);
  set have;
  by cod1;
  if cod2 = _cod2 then output;
end;
drop _cod2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2023 18:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-optimization-with-hashes/m-p/861541#M340326</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-28T18:50:49Z</dc:date>
    </item>
  </channel>
</rss>

