<?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: Performance Issues with merging (Hash Solution needed) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/495480#M130769</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;sry for the late answer.&lt;/P&gt;&lt;P&gt;I get an error message that double values for date / cusip are not valid in table b. But Its not possible that I have double values in it.&lt;/P&gt;&lt;P&gt;I have also tested 2 different SQL statements with select date, cusip vS. select distinct date, cusip and get the same amount of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 19:47:15 GMT</pubDate>
    <dc:creator>mrzlatan91</dc:creator>
    <dc:date>2018-09-13T19:47:15Z</dc:date>
    <item>
      <title>Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494279#M130218</link>
      <description>&lt;P&gt;Hey guys, I currently have problems with my macro in terms of performance issues.&lt;/P&gt;&lt;P&gt;I have the following 2 Tables:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;infile datalines dlm='/';&lt;BR /&gt;input (Date cusip fundid value) ($);&lt;BR /&gt;datalines;&lt;/P&gt;&lt;P&gt;Mar2012/ 123 / A / 5$&lt;BR /&gt;Mar2012/ 123/ B / 6$&lt;BR /&gt;Apr2012 / 124 / B / 6$&lt;BR /&gt;May2012/ 125/ C/ 2$&lt;BR /&gt;Jun2012/ 123/ D/ 4$&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;infile datalines dlm='/';&lt;BR /&gt;input (Date cusip value mod) ($);&lt;BR /&gt;datalines;&lt;/P&gt;&lt;P&gt;Mar2012/ 123 / 4$ / 6$&lt;BR /&gt;May2012/ 125/ 3$ / 7$;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just simply want to make a inner join of the both datasets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally, we have the following characteristics:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table a is a lookup-table which means that every observation of table b exists at least once in table a. But table a&amp;nbsp;&lt;/P&gt;&lt;P&gt;can have observations which table b does not have.&lt;/P&gt;&lt;P&gt;Furthermore, there is a one-to-many-relationship: Table a can have many representations with the same cusip/date combination and table b only have unique observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, my wanted dataset looks like this (classValue is the column mod of table b, but renamed). I just want to output all date/cusip observations of table a that match to table b and additionally add the value mod of table b (and rename it as classValue).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;infile datalines dlm='/';&lt;BR /&gt;input (date cusip fundid value classValue) ($);&lt;BR /&gt;datalines;&lt;BR /&gt;Mar2012/ 123 / A / 5$ / 6$&lt;BR /&gt;Mar2012/ 123/ B / 6$ / 6$&lt;BR /&gt;May2012/ 125/ C/ 2$ / 7$&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current solution looks like this (both datasets are already sorted by date and cusip)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;merge a (in=a) b(in=b keep=date cusip_hld mod rename=(mod=classValue));&lt;BR /&gt;by date cusip;&lt;BR /&gt;if a and b;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, the performance is quite bad.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess, since table a is a lookup-table, a hash solution could probably improve the performance a lot.&lt;/P&gt;&lt;P&gt;Could someone kindly provide me a hash solution for my problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494279#M130218</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-10T19:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494281#M130219</link>
      <description>&lt;P&gt;Data sets are not clear to enable easy copy paste. Can you paste verified your data values as plain text&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494281#M130219</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-10T19:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494285#M130221</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile datalines dlm='/';
input (Date cusip fundid value) ($);
datalines;
Mar2012/ 123 / A / 5$
Mar2012/ 123/ B / 6$
Apr2012 / 124 / B / 6$
May2012/ 125/ C/ 2$
Jun2012/ 123/ D/ 4$
;

 

data b;
infile datalines dlm='/';
input (Date cusip value mod) ($);
datalines;
Mar2012/ 123 / 4$ / 6$
May2012/ 125/ 3$ / 7$
;

data want;
if _n_=1 then do;
if 0 then set b(drop=value);
 dcl hash H (dataset:'b(drop=value)',multidata:'y') ;
   h.definekey  ("Date","cusip") ;
   h.definedata (all:'y') ;
   h.definedone () ;
end;
set a;
if h.find()=0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494285#M130221</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-10T19:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494288#M130222</link>
      <description>&lt;P&gt;Sry mate for the bad representation of my data. Thank you sooooooooooooo much for your quick help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I´m so excited about how much the performance can be improved with that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You always help me, how can I support you for that?&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;&lt;P&gt;For completeness:&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;data a;
input (Date cusip fundid value) ($);
datalines;
Mar2012 123 A 5$
Mar2012 123 B 6$
Apr2012 124 B 6$
May2012 125 C 2$
Jun2012 123 D 4$
;

 

data b;
input (Date cusip value mod) ($);
datalines;
Mar2012 123 4$ 6$
May2012 125 3$ 7$
;

data want;
input (Date cusip fundid value classValue) ($);
datalines;
Mar2012 123 A 5$ 6$
Mar2012 123 B 6$ 6$
May2012 125 C 2$ 7$
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494288#M130222</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-10T19:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494289#M130223</link>
      <description>&lt;P&gt;You may also need to consider memory size when using Hash tables. If your table is very large then you might encounter insufficient memory for hash table processing, you might need to subset the dataset in this case.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 19:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494289#M130223</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-09-10T19:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494300#M130225</link>
      <description>&lt;P&gt;We are here to share knowledge, so no need to thank or be formal. I always enjoyed your enthuse. The same code works for your recent data above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;if _n_=1 then do;&lt;BR /&gt;if 0 then set b(drop=value);&lt;BR /&gt; dcl hash H (dataset:'b(drop=value)',multidata:'y') ;&lt;BR /&gt; h.definekey ("Date","cusip") ;&lt;BR /&gt; h.definedata (all:'y') ;&lt;BR /&gt; h.definedone () ;&lt;BR /&gt;end;&lt;BR /&gt;set a;&lt;BR /&gt;if h.find()=0;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/186452"&gt;@mrzlatan91&lt;/a&gt;&amp;nbsp;Someday we shall have&amp;nbsp; paulaner dunkel dark beer at a nice pub. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Have fun.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 20:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494300#M130225</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-10T20:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494315#M130229</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/186452"&gt;@mrzlatan91&lt;/a&gt; if the thread has been answered, you can mark the question as answered&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 20:35:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494315#M130229</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2018-09-10T20:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494317#M130231</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;Yeah, this would be nice.&lt;/P&gt;&lt;P&gt;Tell me when you´re in Germany &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 20:42:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494317#M130231</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-10T20:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494319#M130233</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;&amp;nbsp;thanks for your advice. Is there a way to find out how much memory is used and available?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 20:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494319#M130233</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-10T20:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494479#M130316</link>
      <description>&lt;P&gt;&lt;STRONG&gt;options fullstimer;&lt;/STRONG&gt; --&amp;gt; This will put some stats in your log. and to find your system memory available use &lt;STRONG&gt;proc options option=memory;run; &lt;/STRONG&gt;or&amp;nbsp; in a macro&amp;nbsp;&lt;STRONG&gt;%let memsize=%sysfunc(getoption(MEMSIZE));&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 13:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494479#M130316</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-09-11T13:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494632#M130382</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;I have tested it now. Unfortunately, the Hash solution is slower than the merge solution.&lt;/P&gt;&lt;P&gt;I´m testing it on a working station and dont have any memory problems (max. used memory is about 20000.00k, OS memory is about 400000.00k). I dont really understand why the hash solution is slower.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another possibility to improve the performance (e.g. using more memory) ?&lt;/P&gt;&lt;P&gt;I have already loaded one of the datasets in the memory (via sasfile).&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 20:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494632#M130382</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-11T20:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494640#M130387</link>
      <description>&lt;P&gt;Can indexed merge help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile datalines dlm='/';
input (Date cusip fundid value) ($);
datalines;
Mar2012/ 123 / A / 5$
Mar2012/ 123/ B / 6$
Apr2012 / 124 / B / 6$
May2012/ 125/ C/ 2$
Jun2012/ 123/ D/ 4$
;

 

data b;
infile datalines dlm='/';
input (Date cusip value mod) ($);
datalines;
Mar2012/ 123 / 4$ / 6$
May2012/ 125/ 3$ / 7$
;


proc datasets library=work nolist;
 modify b;
 index create Date cusip / unique;
 modify a;
 index create keyname=(Date cusip);
quit;

data want;
 merge  a (in=a) b(in=b keep=date cusip mod rename=(mod=classValue));
 by Date cusip;
 if a and b;
 run;

&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 21:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/494640#M130387</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-11T21:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issues with merging (Hash Solution needed)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/495480#M130769</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;sry for the late answer.&lt;/P&gt;&lt;P&gt;I get an error message that double values for date / cusip are not valid in table b. But Its not possible that I have double values in it.&lt;/P&gt;&lt;P&gt;I have also tested 2 different SQL statements with select date, cusip vS. select distinct date, cusip and get the same amount of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 19:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Performance-Issues-with-merging-Hash-Solution-needed/m-p/495480#M130769</guid>
      <dc:creator>mrzlatan91</dc:creator>
      <dc:date>2018-09-13T19:47:15Z</dc:date>
    </item>
  </channel>
</rss>

