<?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: Proc Sql Join with Inequality Condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466442#M119015</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Those results are so different than my past experience, I had to run my own test.&amp;nbsp; I used only two data sets, but increased the number of records to 1B and 100M.&amp;nbsp; Also using _NULL_ as the output, I found less than 1% difference between SET and MERGE.&amp;nbsp; Color me Astounded.&lt;/P&gt;</description>
    <pubDate>Thu, 31 May 2018 13:40:45 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-05-31T13:40:45Z</dc:date>
    <item>
      <title>Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466204#M118934</link>
      <description>&lt;P&gt;Say I have 2 datasets.&lt;/P&gt;&lt;P&gt;Dataset 1 (all IDs and their gender)&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;Gender&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset 2 (IDs I'm not interested in)&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the info from dataset 1 with IDs not found in dataset 2, basically get&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;Gender&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;M&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This can be done with data step and merge (if in dataset 1 but not in dataset 2). How can this be done with proc sql join? When I set an inequality statement using proc sql, the resulted data simply blows up into a cartesian product. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 19:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466204#M118934</guid>
      <dc:creator>apolitical</dc:creator>
      <dc:date>2018-05-30T19:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466211#M118936</link>
      <description>&lt;P&gt;A reasonable SQL approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select * from dataset1 where ID not in (select distinct(ID) from dataset2);&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 19:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466211#M118936</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-30T19:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466232#M118940</link>
      <description>&lt;P&gt;Simply a left join with where condition can result only the records that are in dataset1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select a.* from dataset1 a&amp;nbsp;&lt;/P&gt;
&lt;P&gt;left join dataset2 b on a.id=b.id&lt;/P&gt;
&lt;P&gt;where b.id is null&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 20:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466232#M118940</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-05-30T20:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466241#M118943</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/69320"&gt;@apolitical&lt;/a&gt;&amp;nbsp;In my opinion Joins are not ideal for this&amp;nbsp; task. Rather you are better off dealing with subquery as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;demonstrated. A look up is far convenient than "joining and then filtering"&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 20:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466241#M118943</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-30T20:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466277#M118953</link>
      <description>This one also works fine. Thanks!</description>
      <pubDate>Wed, 30 May 2018 22:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466277#M118953</guid>
      <dc:creator>apolitical</dc:creator>
      <dc:date>2018-05-30T22:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466278#M118954</link>
      <description>Works great, thanks！</description>
      <pubDate>Wed, 30 May 2018 22:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466278#M118954</guid>
      <dc:creator>apolitical</dc:creator>
      <dc:date>2018-05-30T22:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466282#M118956</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;in() clauses are much slower than joins. It doesn't matter for small tables&amp;nbsp;but does when the volume increases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data steps are much faster if the table is sorted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BASE LOOKUP;
  do I=1 to 1e7;
    output BASE;
    if mod(I,10)=0 then output LOOKUP;
  end;
run;
   
proc sql;       * 8.4 s;
  create table FILTERED as 
  select * 
  from BASE 
  where I not in (select I from LOOKUP);
quit;

proc sql;        * 3.3 s;
  create table FILTERED as 
  select * 
  from BASE
         left join 
       LOOKUP
         on BASE.I=LOOKUP.I
  where LOOKUP.I is null;
quit;

data FILTERED;   *1.7 s;
  merge BASE LOOKUP(in=B);
  by I;
  if not B;
run;&lt;/CODE&gt;&lt;/PRE&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>Tue, 23 Oct 2018 21:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466282#M118956</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-10-23T21:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466284#M118957</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; Thank you. I learned something very interesting. Your merge even beats hash in my college lab pc sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1138 data BASE LOOKUP;&lt;BR /&gt;1139 do I=1 to 1e7;&lt;BR /&gt;1140 output BASE;&lt;BR /&gt;1141 if mod(I,10)=0 then output LOOKUP;&lt;BR /&gt;1142 end;&lt;BR /&gt;1143 run;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.BASE has 10000000 observations and 1 variables.&lt;BR /&gt;NOTE: The data set WORK.LOOKUP has 1000000 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.51 seconds&lt;BR /&gt;cpu time 0.51 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1144&lt;BR /&gt;1145 data want;&lt;BR /&gt;1146 if _n_=1 then do;&lt;BR /&gt;1147 dcl hash h(dataset:'lookup');&lt;BR /&gt;1148 h.definekey ('I') ;&lt;BR /&gt;1149 h.definedone () ;&lt;BR /&gt;1150 end;&lt;BR /&gt;1151 set base;&lt;BR /&gt;1152 if h.check() ne 0;&lt;BR /&gt;1153 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 1000000 observations read from the data set WORK.LOOKUP.&lt;BR /&gt;NOTE: There were 10000000 observations read from the data set WORK.BASE.&lt;BR /&gt;NOTE: The data set WORK.WANT has 9000000 observations and 1 variables.&lt;BR /&gt;&lt;STRONG&gt;NOTE: DATA statement used (Total process time):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;real time 2.45 seconds&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cpu time 2.45 seconds&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 23:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466284#M118957</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-30T23:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466285#M118958</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Yes indeed, MERGE BY is extremely efficient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is only (largely) beaten by MERGE without BY, when both tables are known to have exactly the same record keys.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's one fast machine you have, where the disks have to wait for the CPU!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 23:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466285#M118958</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-30T23:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466288#M118959</link>
      <description>&lt;P&gt;Yes and great. But wouldn't the&amp;nbsp; requirement of presort kill the "merge" charm a bit?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 23:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466288#M118959</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-30T23:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466291#M118961</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Yes and no. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;1. Sometimes you don't have to sort. Data steps&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;usually&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;create&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a sorted table.&lt;/P&gt;
&lt;P&gt;2. If you want a sorted output, then there is no loss.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. If SQL chooses to join by sorting,&amp;nbsp;&lt;SPAN&gt;then there is no loss and you gain a sorted output.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MERGE is less advantageous if the input is not sorted and if you don't want&amp;nbsp;a sorted&amp;nbsp;output for further processing and if SQL is faster (maybe because it joins with a hash).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's a downside of SQL: it creates non-sorted data from sorted inputs.&lt;/P&gt;
&lt;P&gt;Sorted tables are usually much more efficient to process, and I like to keep them that way if I can. That's one of the advantages of a DWH/BI database like SAS when compared to transactional databases. It can keep the data sorted for smarter or more efficient processing.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 00:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466291#M118961</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-31T00:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466298#M118966</link>
      <description>&lt;P&gt;Depending on the size of the lookup table and the shape of the base table, modifying in place can be even faster than MERGE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BASE; 
  set LOOKUP; 
  modify BASE key=I;  
  if _IORC_= %sysrc(_sok) then remove; 
  else _ERROR_=0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the very narrow table here, MERGE is faster, but if you make the BASE table wider or if you decrease the size of the&amp;nbsp;LOOKUP table, MODIFY KEY= becomes much faster than MERGE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An index must exist on table BASE.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 02:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466298#M118966</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-31T02:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466301#M118968</link>
      <description>&lt;P&gt;If we're going to imagine that the data sets are sorted, SET will usually far outperform MERGE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set lookup base (in=keepme);&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;if keepme and first.id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This particular version requires no duplicate IDs within BASE.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 02:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466301#M118968</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-31T02:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466304#M118970</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;That's not my experience. SET BY is usually much slower than MERGE BY.&lt;/P&gt;
&lt;P&gt;With this test, about&amp;nbsp;the same, within a margin of error.&lt;/P&gt;
&lt;P&gt;With a fuller test, there is a definitive difference.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; * 23s;
  set BASE BASE BASE BASE BASE BASE BASE BASE;
  by I;
run;

data _null_; * 8s;
  merge BASE BASE BASE BASE BASE BASE BASE BASE;
  by I;
run;&lt;/CODE&gt;&lt;/PRE&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 03:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466304#M118970</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-31T03:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466442#M119015</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Those results are so different than my past experience, I had to run my own test.&amp;nbsp; I used only two data sets, but increased the number of records to 1B and 100M.&amp;nbsp; Also using _NULL_ as the output, I found less than 1% difference between SET and MERGE.&amp;nbsp; Color me Astounded.&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 13:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466442#M119015</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-31T13:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql Join with Inequality Condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466649#M119086</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;The BY statement really slows things down. But more so for SET it seems. Without BY, SET is faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose it's to with managing the PDV: MERGE populates it once per key value for all tables, SET populates it once&amp;nbsp;per key value per table, so the underlying table-reading routine must be different. But I am only making assumptions here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values are CPU-bound on my server:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data BASE ;
  do I=1 to 1e8;
    output ;
  end;
run;

sasfile BASE load;

data _null_ ;set   BASE;       run; * 3.8s;
data _null_ ;merge BASE;       run; * 5.4s; 

data _null_ ;set   BASE; by I; run; * 9.5s;
data _null_ ;merge BASE; by I; run; * 9.3s; 

sasfile BASE close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 23:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-Join-with-Inequality-Condition/m-p/466649#M119086</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-05-31T23:00:32Z</dc:date>
    </item>
  </channel>
</rss>

