<?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: DATA MERGE on large datasets but SAS runs out of memory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553401#M153890</link>
    <description>&lt;P&gt;Ok&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if you can follow this and execute&lt;/P&gt;
&lt;P&gt;"1. Do both the datasets have the same set of ID's or could it differ? &lt;EM&gt;&lt;STRONG&gt;It could differ&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;2. Do the names of the ID's or in other words keys differ?&lt;EM&gt;&lt;STRONG&gt; IDs in two datasets are same name and format.&lt;/STRONG&gt;&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA LARGE;
INPUT ID $ CODES $ DATE; 
CARDS;
ALLSS 04185 18127 
ALLSS 04185 18129 
ALLSS 04185 18130 
ALLSS 25000 16840 
ALLSS 25000 16874 
ALLSS 25000 16972 
ALLSS 25000 17063 
ALLSS 25000 17184 
ALLSS 25000 17188 
AALLSS 25000 17231 
AALLSS 25000 17321 
AALLSS 25000 17458 
AALLSS 25000 17604 
AALLSS 25000 17867 
AALLSS 25000 17979 
AALLSS 25000 18078 
AALLSS 25002 17374 
AALLSS 2669 17545 
AALLSS 2689 17374 
AALLSS 2689 17601 
AALLSS 2720 17184 
AALLSS 2724 16840 
AALLSS 2724 17063 
AALLSS 2724 17175 
AALLSS 2724 17231 
AALLSS 2724 17321 
AALLSS 2724 17374 
AALLSS 2724 17601 
AALLSS 2724 17867 
AALLSS 2724 17979 
AALLSS 2729 17188 
AALLSS 2752 17184 
AALLSS 2772 17825 
AALLSS 27800 17184 
AALLSS 2859 16552 
AALLSS 2859 16664 
AALLSS 2859 16852 
AALLSS 2859 16909 
AALLSS 2948 17184 
AALLSS 30000 17545 
AALLSS 311 16874 
AALLSS 311 16972 
AALLSS 311 17321 
AALLSS 311 17458 
AALLSS 311 18078 
AALLSS 32723 17184 
AALLSS 3310 17188 
AALLSS 4019 16636 
AALLSS 4019 16840 
AALLSS 4019 16874 
AALLSS 4019 16909 
AALLSS 4019 16972 
AALLSS 4019 17063 
AALLSS 4019 17175 
AALLSS 4019 17184 
AALLSS 4019 17188 
AALLSS 4019 17231 
AALLSS 4019 17321 
AALLSS 4019 17374 
AALLSS 4019 17458 
AALLSS 4019 17601 
AALLSS 42760 17604 
AALLSS 4293 17184 
AALLSS 43491 17184 
AALLSS 43491 17185 
AALLSS 43491 17186 
AALLSS 43491 17187 
AALLSS 4660 17825 
AALLSS 496 16840 
AALLSS 496 16874 
AALLSS 496 16905 
AALLSS 496 16935 
AALLSS 496 16966 
AALLSS 496 16996 
AALLSS 496 17027 
AALLSS 496 17058 
AALLSS 496 17088 
AALLSS 496 17119 
AALLSS 496 17149 
AALLSS 496 17180 
AALLSS 496 17211 
AALLSS 496 17239 
AALLSS 496 17270 
AALLSS 496 17300 
AALLSS 496 17331 
AALLSS 496 17361 
AALLSS 496 17392 
AALLSS 496 17423 
AALLSS 496 17453 
AALLSS 496 17458 
AALLSS 496 17484 
AALLSS 496 17514 
AALLSS 496 17545 
AALLSS 496 17576 
AALLSS 496 17605 
AALLSS 496 17636 
AALLSS 496 17666 
AALLSS 496 17697 
AALLSS 496 17727 
AALLSS 496 17758 
;

DATA SMALL;
length id $8;
id='AALLSS';
RUN;
/*sort is need for by group processing i.e do until;set;by*/
proc sort data=large;
by ID;
run;
/*Keeping only the matching(exisiting) ids in small*/
proc sql;
create table temp as 
select *
from large
where id in (select id from small)
order by id;
quit;

/*The following requires a sorted approach hence the proc sort by id*/
data want;
if _n_=1 then 
    do;
      if 0 then set small large;
      dcl hash h1 (multidata:'y');
      h1.defineKey('id');
      h1.defineData('codes','date');
      h1.defineDone();
    end;
/*Reading your large by id i.e only one id at a time and load
in the hash object*/
do until(last.id);
set temp;
by id;
rc=h1.add();
end;
/*Reading your small and look up the large*/
do until(last.id);
set small;
by id;
  do while(h1.do_over() eq 0);
    output;
  end;
end;
/*Clear the contents of hash freeing memory space after processing each id*/
h1.clear();
drop rc:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Apr 2019 20:08:11 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-04-23T20:08:11Z</dc:date>
    <item>
      <title>DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553193#M153802</link>
      <description>&lt;P&gt;Hi Folks, I have a work space issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran SAS overnight to merge&amp;nbsp;Z.ALL_SITES (76.4GB) and Z.DATA_LARGE (560MB). SAS crashed "out of memory" this morning. And I cleaned H and Z folders except the datasets needed. Folder ''H" has 1.96TB for a free space. Folder Z has 490GB for a free space.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll appreciate any suggestions.&lt;/P&gt;
&lt;P&gt;Thanks zillions in advance. This is being a huge roadblock. I can't move on my project because of this memory issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA H.MERGED;
MERGE
     Z.ALL_SITES  (IN=A)
     Z.DATA_LARGE (IN=B);
BY ID;
IF A AND B;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2019 12:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553193#M153802</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T12:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553208#M153807</link>
      <description>&lt;P&gt;Maxim 3: Know Your Data. Inspect your input datasets for large columns, and if those datasets are stored with compress=yes.&lt;/P&gt;
&lt;P&gt;If you are unsure, post the output of proc contents for both datasets here.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 12:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553208#M153807</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-23T12:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553219#M153814</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Folks, I have a work space issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran SAS overnight to merge&amp;nbsp;Z.ALL_SITES (76.4GB) and Z.DATA_LARGE (560MB). SAS crashed "out of memory" this morning. And I cleaned H and Z folders except the datasets needed. Folder ''H" has 1.96TB for a free space. Folder Z has 490GB for a free space.&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A minor point here: running out of memory is not the same thing as not having enough free disk space. I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;is on the right track to solving the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553219#M153814</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-23T13:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553228#M153818</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot. Below is the proc contents of both datasets. I only need ID, VAR1 and VAR2 from the DATA_LARGE and tempted to keep the variables I only needed. However, since I can not remove original DATA_LARGE from the folder then this would just reduce the work space in the folder R. &lt;/P&gt;
&lt;P&gt;Correct?&lt;/P&gt;
&lt;P&gt;What do you think?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA R.DATA_LARGEA; SET R.DATA_LARGE(KEEP=ID VAR1 VAR2);
WHERE VAR1 NE .; 
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LARGE DATA.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28937iD0D51EBDC8A710C0/image-size/large?v=v2&amp;amp;px=999" role="button" title="LARGE DATA.png" alt="LARGE DATA.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553228#M153818</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T13:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553229#M153819</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "out of memory" issue is kind of weird given the code you've posted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The merge step would only ever load a single row at a time into memory (the PDV) and though not require much memory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only reason I can think of that the code you've posted could throw an "out of memory" error is if the "tables" in the Merge statement are actually Views - and it's these views which consume a lot of memory during view execution time (which would happen as part of the merge statement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...so: If my theory applies then the first step is to change the views to tables (with option compress=yes); and eventually try to implement code for the views (now tables) which is more memory efficient.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553229#M153819</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T13:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553231#M153821</link>
      <description>Regarding data set compression, the issue is not whether the incoming data sets are compressed or not.  They are on the Z drive, and you need more space on the H drive.&lt;BR /&gt;&lt;BR /&gt;If the data contains a lot of character variables, add this statement before the merge:&lt;BR /&gt;&lt;BR /&gt;options compress=yes;&lt;BR /&gt;&lt;BR /&gt;If it contains more numeric variables, add this instead:&lt;BR /&gt;&lt;BR /&gt;options compress=binary;</description>
      <pubDate>Tue, 23 Apr 2019 13:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553231#M153821</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-23T13:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553236#M153824</link>
      <description>&lt;P&gt;You can do all of the work in one step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data h.merged (compress=yes);
merge
  z.all_sites (in=a)
  z.data_large (
    in=b
    keep=id var1 var2
    where=(var1 ne .)
  )
;
by id;
if a and b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please post the log from that step, if it fails. Use the {i} button for posting logs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS if you enable listing output in Enterprise Guide, you can copy/paste the text to a {i} window also, so you don't need to make screenshots.&lt;/P&gt;
&lt;P&gt;It's my favorite method of posting results.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553236#M153824</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-23T13:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553255#M153829</link>
      <description>&lt;P&gt;Since&amp;nbsp;&lt;SPAN&gt;Z.DATA_LARGE (560MB) is very small.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hash Table is the best way to do it .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or try PROC FORMAT .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553255#M153829</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-23T13:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553256#M153830</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kurt, I'm running the code you suggested. Last time it crashed after few hours when I ran it overnight.But this time I don't know how many hours this will run. I will post the log as soon as it's finished.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm concerned about Astounding's pointer that I might need more space in H drive. H drive is empty for a purpose to output MERGED dataset. I can't change the size of this folder easily because it's not my private computer.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 13:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553256#M153830</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T13:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553258#M153831</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;actually looked at your Proc Contents report and calculated the required memory for the variables you're after. If that's only around 1/2 GB then you've got likely sufficient memory and the data step hash lookup could work.&lt;/P&gt;
&lt;P&gt;Below code based on the code you've posted but of course not tested as you haven't provided sample data. Give it a go an let us know if it works.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data h.merged;
  if _n_=1 then 
    do;
      if 0 then set z.data_large(keep=(id var1 var2));
      dcl h1 (dataset:'z.data_large(keep=(id var1 var2))';
      h1.defineKey('id');
      h1.defineData('var1','var2');
      h1.defineDone();
    end;
  set z.all_sites;
  if h1.find()=0 then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553258#M153831</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553263#M153832</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the "like". Please use the latest (current) cut of my code for testing as I had to fix it since the initial post.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553263#M153832</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553267#M153835</link>
      <description>&lt;P&gt;is h1 taking its h from libname h? I'm trying to customize the code to my actual directories. thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553267#M153835</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T14:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553273#M153838</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just for clarity: The code I've posted assumes that the relationship between z.all_sites to z.data_large is N:1 or 1:1.&lt;/P&gt;
&lt;P&gt;If the relationship is 1:N and you're after left join logic then the code I've posted would require some additional looping (using the hash do_over method).&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553273#M153838</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553275#M153839</link>
      <description>&lt;P&gt;h1 is the reference for the hash table the code defines (command DCL stands for DECLARE). You could use any name here. Conceptually the same like when defining a libref in a libname statement.&lt;/P&gt;
&lt;P&gt;The libref for your source table is used within the dataset option of the Hash Declare statement.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553275#M153839</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553276#M153840</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi Patrick,&lt;/P&gt;
&lt;P&gt;This is 1:N relationship. 1 side has unique ID with no duplicates. N side is all the claim that patient had ever made in her/his entire medical history. So 1:N can actually be 1:1000 at least all the way to 1:5000 because claim data captures every drug, diagnosis or procedures of multiple chronic diseases.&lt;/P&gt;
&lt;P&gt;What can be done in this context? like you said looping? can you extend the code for looping? if possible?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553276#M153840</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T14:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553277#M153841</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;O.K., I'll post some code. Without sample data to test I can't promise you though that it will be syntactically correct. It's getting late where I live so others might need to take over after that.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553277#M153841</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553278#M153842</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll provide you a sample data asap.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553278#M153842</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T14:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553279#M153843</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here you go:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data h.merged;
  if _n_=1 then 
    do;
      if 0 then set z.data_large(keep=(id var1 var2));
      dcl h1 (dataset:'z.data_large(keep=(id var1 var2))';
      h1.defineKey('id');
      h1.defineData('var1','var2');
      h1.defineDone();
    end;
  set z.all_sites;
  do while(h1.do_over() eq 0);
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lecompobjref/69740/HTML/default/viewer.htm#p07odyzmifa4y3n10pkcvfdbtn4l.htm" target="_blank" rel="noopener"&gt;http://support.sas.com/documentation/cdl/en/lecompobjref/69740/HTML/default/viewer.htm#p07odyzmifa4y3n10pkcvfdbtn4l.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:34:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553279#M153843</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-23T14:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553282#M153844</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt; I get this error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;254  data O.MERGED;
255    if _n_=1 then
256      do;
257        if 0 then set R.data_large(keep=(id var1 var2));
                                   -
                                   214
                                   23
258        dcl h1 (dataset:'R.data_large(keep=(id var1 var2))';
               --
               565
ERROR: DATA STEP Component Object failure.  Aborted during the COMPILATION phase.
ERROR 214-322: Variable name ( is not valid.

ERROR 23-7: Invalid value for the KEEP option.

ERROR 565-185: H1 is not a known class name.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

259        h1.defineKey('id');
260        h1.defineData('var1','var2');
261        h2.defineDone();
262      end;
263    set R.all_sites;
264    do while(h1.do_over() eq 0);
265      output;
266    end;
267  run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553282#M153844</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-04-23T14:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: DATA MERGE on large datasets but SAS runs out of memory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553288#M153846</link>
      <description>&lt;P&gt;To whom it may concern,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the very moment the use of do over aka find_next before 9.4 equivalent is in place, and should the look up be 1:N&amp;nbsp; ,&amp;nbsp; dcl hash h1 (dataset:'large'&lt;STRONG&gt;,multidata:'y')&lt;/STRONG&gt;;&amp;nbsp; would be required.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp; &amp;nbsp;That's just a syntax error&lt;/P&gt;
&lt;P&gt;Here is the correction&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;dcl hash h1 &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;dataset:&lt;SPAN class="token string"&gt;'R.data_large(keep=(id var1 var2))'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATA-MERGE-on-large-datasets-but-SAS-runs-out-of-memory/m-p/553288#M153846</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-23T14:54:10Z</dc:date>
    </item>
  </channel>
</rss>

