<?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: A join in proc sql takes 5 hours and consumes a lot of disk space in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184222#M46843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;rachel escribió:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Sergio,&lt;/P&gt;
&lt;P&gt;I created&amp;nbsp; two fake data sets.&lt;/P&gt;
&lt;P&gt;One with 50mil rows, the other with 30 mil rows.&lt;/P&gt;
&lt;P&gt;Then I merge then.&lt;/P&gt;
&lt;P&gt;Remember in a hash join for large data place the smalled data on top.&lt;/P&gt;
&lt;P&gt;Here is the code;&lt;/P&gt;
&lt;P&gt;******************************************&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;Thanks a lot rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2014 17:12:27 GMT</pubDate>
    <dc:creator>SergioSanchez</dc:creator>
    <dc:date>2014-06-05T17:12:27Z</dc:date>
    <item>
      <title>A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184196#M46817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to do a join with datasets that have over 50 millions of rows each one and it´s a nightmare. It takes 5 hours or more in perform the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont know if there is a better solution, testing with a merge statement takes too much time too because the datasets need to be sorted and&lt;BR /&gt;these tasks takes time and I have read that proc sort don´t use an index to perfom the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plus the disk space is reduced drastically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anybody help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better solution to achieve the result without have to wait for 5 hours?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advanced&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 16:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184196#M46817</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-03T16:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184197#M46818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is the data? What kind of join are you doing? What is the join on, what indexes are available? Is the result of the join much smaller than the joined tables? Are you getting a message from SAS about a join that can't be optimized? We need answers to these questions to optimize the operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 16:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184197#M46818</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-06-03T16:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184198#M46819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you have an advanced join, Proc Sql can cause a lot of overhead. the "Cartesian product" being famous for that.&lt;BR /&gt;Show you source / describe your data what you want to achieve. There are a lot more technical solutions a just a SQL.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 17:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184198#M46819</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-06-03T17:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184199#M46820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add indexes to the join conditions and rerun the query on a subset of the data to test performance. When you are happy with the performance increases on the subset of data, run the join on all of the data (with indexes).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 19:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184199#M46820</guid>
      <dc:creator>skillman</dc:creator>
      <dc:date>2014-06-03T19:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184200#M46821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some generic things to look at&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etlug/60948/HTML/default/viewer.htm#n0t211jnbbhrfbn11h4va03f2ovc.htm" title="http://support.sas.com/documentation/cdl/en/etlug/60948/HTML/default/viewer.htm#n0t211jnbbhrfbn11h4va03f2ovc.htm"&gt;SAS(R) Data Integration Studio 4.2: User's Guide&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(The link refers to DI, but the recommendations are largely for Base SAS.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your data are in a remote database (Oracle, etc.), SAS will try to run the join on the database.&amp;nbsp; However, some things that are allowed on SAS SQL don't exist in one (or more) of the remote system types and will force SAS to bring all of the data to the SAS workspace.&amp;nbsp; Pass-thru SQL gives you more control with remote databases, but requires more knowledge on your part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 19:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184200#M46821</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2014-06-03T19:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184201#M46822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If Join involves remerging summary stats to the original data then it will also slow down the joining process.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 21:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184201#M46822</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-03T21:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184202#M46823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The processing of IO is with SQL designed to be random for a OLTP. That is why OLTP dbms is not the best approach for analytics and a lot of others have been developed.&lt;BR /&gt;The SAS dataset is already a classic one but this has been designed for sequential processing in a ordered way.&lt;BR /&gt;Do you access a little portion of the dataset and using this many times with slightly different subsets indexing will be a great help.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having an external DBMS the communication line will often be the bottleneck. Let the data be as close to the source being processed when possible (federation).&lt;BR /&gt;The SQL pass-through should be done without seeing that. the sqltrace&amp;nbsp; option can give you some proceedings. (implicit sql pass through).&lt;/P&gt;&lt;P&gt;You can code explicit pass through when you are needing special unique SQL language features, SQL has many dialects not all being ANSI-SQL.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All is about knowing your data and how that will be processed technically. Your machine will not choose an optimal performance approach. &lt;BR /&gt;That is your, the human, responsibility.&amp;nbsp; What are all those details you have to deal with? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 05:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184202#M46823</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-06-04T05:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184203#M46824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Once you get to REAL data sets (50 million rows is in this range), you need to take care of your storage infrastructure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) make it FAST, using high-rpm disks or SSDs for the work area. If you are concerned about failsafes, use RAID1 (simple mirrors). If being failsafe is not a big thing, use striping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) separate your UTILLOC physically from the work/data location, and make sure these disks do nothing else. UTILLOC is where the intermediate file is stored during PROC SORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then look at this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) use a combination of proc sort and data steps to do the merge. PROC SQL is a resource hog of the nth order when it comes to large joins. Real life experience here has shown that SQL gets progressively slower when several processes are running, much more than the sort/merge steps. Up to a point where the server becomes unresponsive, which is very rare with an AIX system(!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) indexes usually don't help (much), because in addition to the data, SAS needs to read the index, causing even more I/O. Indexes are very good if you need to access a small subset of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c) identify which sort criteria will be needed most, and have your data sets already sorted correctly when you store them. That way users (including yourself) do not need to sort and can read the big datasets sequentially.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d) when you do a data step merge, you need space for (just) the source files and the target files. With SQL, you also need space for the utiilty file, which will grow to a size equal of all the source files together. During the sorts preceding the merge, you only need extra space for the file being sorted, the temp file will be in UTILLOC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 07:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184203#M46824</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-06-04T07:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184204#M46825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, thanks for the help it´s much appreciated for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, I´ll try to answer your questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data are in an Oracle Server and I make a copy of the datasets connecting to the server through a libname statement and after&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;set b (where = (var1&amp;lt;= date and var2&amp;gt;date and var3&amp;gt;date); where "b" is the dataset on the Oracle server&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do a left join, the target in most of the cases is to obtain the surrogate key of the second table and one or two variables more.Something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table x as&lt;/P&gt;&lt;P&gt;select a.*, b.var1, b.var2, b.var3&lt;/P&gt;&lt;P&gt;from dataset1 as a left join dataset2 as b&lt;/P&gt;&lt;P&gt;on (a.var1 = b.var1);&lt;/P&gt;&lt;P&gt;quit; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no index at all in any of the datasets and no message appears in the log about an issue in the performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 07:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184204#M46825</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-04T07:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184205#M46826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort&lt;/P&gt;&lt;P&gt;&amp;nbsp; data=b /* this is your original oracle data set */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (where = (var1&amp;lt;= date and var2&amp;gt;date and var3&amp;gt;date)&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=dataset1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;by var1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort&lt;/P&gt;&lt;P&gt;&amp;nbsp; data=dataset2 (keep=var1 var2 var3)&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=data2x&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;by var1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;merge&lt;/P&gt;&lt;P&gt;&amp;nbsp; dataset1 (in=a)&lt;/P&gt;&lt;P&gt;&amp;nbsp; data2x&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;by var1;&lt;/P&gt;&lt;P&gt;if a;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Compare this method and the SQL method using options fullstimer;&lt;/P&gt;&lt;P&gt;Also watch the disks while the jobs are running; you may be surprised by the disk usage(s).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I remember when I first came across a piece of code done by a SAS consultant that had &amp;gt; 100 lines. I quickly saw that I could do the same in one create table with ~ 10 lines in PROC SQL, so why bother with all that code? Then I had to wait 5 hours for my SQL to finish, while his code took about 20 minutes to produce the same result. With less than half the disk space.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 08:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184205#M46826</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-06-04T08:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184206#M46827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a previous post had mentioned why not perform your tasks on the SQL server where your data resides, store the results into a temporary table and then extract the data into SAS?&amp;nbsp; SQL databases should be fully optimized and geared up to performing code on very large datasets, although once you reach a certain point then it becomes less a database and more of a data warehouse with different storage requirements and processes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 08:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184206#M46827</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-04T08:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184207#M46828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope you are allowed to define tables at Oracle. &lt;BR /&gt;The DBA often is doing a forbid for users as the DDL (Data Definition language) is his area. If you would extend this to Excel usage nobody would be allowed to define a spreadsheet.&lt;/P&gt;&lt;P&gt;The common usage with a RDBMS is DML (Data Manipulation Language) the parts of SQL giving you access to tables.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;data a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;set b (where = (var1&amp;lt;= date and var2&amp;gt;date and var3&amp;gt;date); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;b is the dataset on Oracle. The selection will run and store the result table into a SAS table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;create table x as&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;select a.*, b.var1, b.var2, b.var3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;from dataset1 as a left join dataset2 as b&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;on (a.var1 = b.var1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;b is the dataset2 on Oracle and a dataset1 in SAS. The join will run on tables with a different storage type.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;This logic is only possible with SAS-SQL, but the disadvantage will be much overhead as the only way to solve this making a copy of the table in SAS. &lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;It will happen automatic behind scenes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;What can you do for performance?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;1. having the DDL open in Oracle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Define the table a within Oracle not SAS. You could use Explicit pass through when implicit is still causing copying of the data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Use the SAStrace option to analyze what is happening.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Define the table x as you wish, but decide an what side Oracle or SAS it should be. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;2. NOT having the DDL open in Oracle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp; Copy the table into SAS environment and make the selection/join as smart as you can do. &lt;BR /&gt;&amp;nbsp;&amp;nbsp; As some table-lookup looks to be done, you could also thing on using hashing or SAS formats&lt;BR /&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; Your SQL sample is really simple an looks to be able to be done in one pass without join or whatever. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n1mar4dz971ln3n1lxmgx7hcgyc0.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n1mar4dz971ln3n1lxmgx7hcgyc0.htm"&gt;SAS(R) 9.3 SQL Procedure User's Guide&lt;/A&gt;&lt;/SPAN&gt; sqlconstdatetime&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#n0732u1mr57ycrn1urf24gzo38sc.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#n0732u1mr57ycrn1urf24gzo38sc.htm"&gt;SAS/ACCESS(R) 9.3 for Relational Databases: Reference, Second Edition&lt;/A&gt; sastrace&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#n05b4mygsvt845n1vnr6r5kchbjf.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#n05b4mygsvt845n1vnr6r5kchbjf.htm"&gt;SAS/ACCESS(R) 9.3 for Relational Databases: Reference, Second Edition&lt;/A&gt; Sql pass through specifics Oracle&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#p0ewb0agff5a1vn1mq7lox50dtwh.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/65247/HTML/default/viewer.htm#p0ewb0agff5a1vn1mq7lox50dtwh.htm"&gt;SAS/ACCESS(R) 9.3 for Relational Databases: Reference, Second Edition&lt;/A&gt; bulk loading Oracel&amp;nbsp; (do not forget Oracle performance) &lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 11:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184207#M46828</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-06-04T11:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184208#M46829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are not telling where your "dataset2" is stored. If that one is i Oracle two, consider to move all processing to Oracle (SQL implicit/explicit pass-thru).&lt;/P&gt;&lt;P&gt;If you lookup surrogate keys from dataset2, it sounds like that is a permanent table, which mean you could consider applying an index to to it.&lt;/P&gt;&lt;P&gt;When doing similar work in DI Studio, there Look-up transformation is using data step hash tables. This technique has the benefit that it does not require that the "master" table to be sorted, it just performs a clean table scan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps your whole process could be re-configured, but there's too little information at this point to give any suggestion in that direction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 12:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184208#M46829</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-06-04T12:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184209#M46830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry guys, my PC have been half to death all day and I couldn´t test your adviced. &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;I'm trying to sent a the query to Oracle server but I recive an error like this &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;ERROR: PROC SQL requires any created table to have at least 1 column.&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;96&amp;nbsp;&amp;nbsp; options fullstimer;&lt;/P&gt;&lt;P&gt;97&amp;nbsp;&amp;nbsp; options sastrace=',,,s ,,d, ,,t,' sastraceloc=saslog nostsuffix;&lt;/P&gt;&lt;P&gt;98&lt;/P&gt;&lt;P&gt;99&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;100&amp;nbsp; connect to odbc as oracle (USER=aaaaaa PW=XXXXXXXX DSN='pppp');&lt;/P&gt;&lt;P&gt;101&amp;nbsp; create table result as select * from connection to oracle&lt;/P&gt;&lt;P&gt;102&amp;nbsp; (select a.var1, a.var2, a.var3, a.var4, a.var5,&lt;/P&gt;&lt;P&gt;102&amp;nbsp; a.var6, a.var7, a.var8, a.var9, a.var10, b.var1, b.var2&lt;/P&gt;&lt;P&gt;104&amp;nbsp; from epi as a left join blas b on (a.var1 = b.var1)&lt;/P&gt;&lt;P&gt;105&amp;nbsp; where a.var1 &amp;lt;= date and a.var2 &amp;gt;= date and 105! a.var3&amp;gt;date);&lt;/P&gt;&lt;P&gt;ERROR: PROC SQL requires any created table to have at least 1 column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LinusH, both datasets are in the work library, I copy it&amp;nbsp; from a DWH in Oracle server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the link Jaap, &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;It's&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;very&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;helpful for&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;me.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps alt-edited"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps alt-edited"&gt;One more thing, I haven`t permissions for create, modify or alter tables in the Server so all &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;the tables that&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;I&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;create should&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;be&lt;/SPAN&gt; in the &lt;SPAN class="hps"&gt;local drive&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps alt-edited"&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps alt-edited"&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;Regards&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 16:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184209#M46830</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-04T16:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184210#M46831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sergio,&lt;/P&gt;&lt;P&gt;When using pass thru in the past, I see two things that could be the cause of your error message. The "as a" might be an issue.&amp;nbsp; Try " epi a".&amp;nbsp; The other issue may be that there are no rows selected by your where statement.&amp;nbsp; Try testing with just one of the were conditions. Are the values in "var1" and "date" formatted exactly the same?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;104&amp;nbsp; from &lt;STRONG&gt;epi as a&lt;/STRONG&gt; left join blas b on (a.var1 = b.var1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;105&amp;nbsp; where a.var1 &amp;lt;= date and a.var2 &amp;gt;= date and 105! a.var3&amp;gt;date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;ERROR: PROC SQL requires any created table to have at least 1 column&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;This is code that worked for me in the past. "Doris" is the name of the Oracle database that lived in a UNIX environment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;proc sql feedback inobs=max outobs=max;&lt;/P&gt;&lt;P&gt; drop table dlib.hstclmshdr;&lt;/P&gt;&lt;P&gt;connect to oracle (user="&amp;amp;userd." password="&amp;amp;passd." &lt;A href="mailto:path='@voadhoc'"&gt;path='mypath'&lt;/A&gt;&lt;/P&gt;&lt;P&gt;schema=doris preserve_comments buffsize=8000);&lt;/P&gt;&lt;P&gt; create table work.claims as&lt;/P&gt;&lt;P&gt; select G.*&lt;/P&gt;&lt;P&gt; from connection to oracle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select d.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from doris.inst_claim_header d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&amp;nbsp; (d.line_of_business = 'HST')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and&amp;nbsp; (d.claim_thru_date between TO_DATE('01/01/2012','MM/DD/YYYY') and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_DATE('12/31/2012','MM/DD/YYYY'))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 16:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184210#M46831</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-04T16:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184211#M46832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Morning all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jwillis your code doesn't work for me, it`s neither an alias issue or were conditions.:smileycry::smileycry:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll see if I am able to find a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 07:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184211#M46832</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-05T07:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184212#M46833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sergio,&lt;BR /&gt;Jwillis has used an installation with an oracle client (schema=). That one is offering more advanced options. The oracle client is a free client from oracle but is requiring a SAS license for SAS/Access to Oracel. You are using the ODBC method obviously using the Windows client (DSN= ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Within a DBMS (explicit pass through) there is a common separation by schema-s. This looking like the libnames in SAS. &lt;BR /&gt;You cannot intermix libnames (SAS environment) and schemas (DBMS environment).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important difference imo is " as&amp;nbsp; select G.*"&amp;nbsp;&amp;nbsp; between the create and from connection&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 07:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184212#M46833</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-06-05T07:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184213#M46834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Jaap Karman escribió:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Sergio,&lt;BR /&gt;Jwillis has used an installation with an oracle client (schema=). That one is offering more advanced options. The oracle client is a free client from oracle but is requiring a SAS license for SAS/Access to Oracel. You are using the ODBC method obviously using the Windows client (DSN= )&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Within a DBMS (explicit pass through) there is a common separation by schema-s. This looking like the libnames in SAS. &lt;BR /&gt;You cannot intermix libnames (SAS environment) and schemas (DBMS environment).&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The important difference imo is " as&amp;nbsp; select G.*"&amp;nbsp;&amp;nbsp; between the create and from connection &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;Sorry Jaap but I don't understand anything, I run the following code and it works perfectly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: navy;"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: navy;"&gt;sql&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;connect&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;to&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; odbc &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;as&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; aaaaaa(dsn=xxxx USER=xxxxx PW=xxxxxx);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;create&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;table&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; test &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; * &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;from&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; connection to aaaaaa&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; * &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: blue;"&gt;from&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Courier New'; background: white; color: black;"&gt; schemaname.tablename);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;After the code run I can see the dataset in my library, what is the difference between this code and the join I try to execute?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 08:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184213#M46834</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-05T08:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184214#M46835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: navy; font-family: 'Courier New';"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: navy; font-family: 'Courier New';"&gt;sql&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;connect&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;to&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; odbc &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;as&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; aaaaaa(dsn=xxxx USER=xxxxx PW=xxxxxx);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;create&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;table&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; test &lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG style="font-size: 14pt;"&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;as&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; * &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;from&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; connection to aaaaaa&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt;(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;select&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; * &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: blue; font-family: 'Courier New';"&gt;from&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="background: white; color: black; font-family: 'Courier New';"&gt; schemaname.tablename);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: navy; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 09:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184214#M46835</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-06-05T09:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: A join in proc sql takes 5 hours and consumes a lot of disk space</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184215#M46836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, another option, I am downloading the table order by thee key&amp;nbsp; variable using pass thourh. After this I'll downloading the second table, ordering too.&lt;/P&gt;&lt;P&gt;This way I suppose I dont need the proc sort and I can perfom a merge to find wich rows are in common.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you think about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 10:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/A-join-in-proc-sql-takes-5-hours-and-consumes-a-lot-of-disk/m-p/184215#M46836</guid>
      <dc:creator>SergioSanchez</dc:creator>
      <dc:date>2014-06-05T10:36:51Z</dc:date>
    </item>
  </channel>
</rss>

