<?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: SAS proc SQL and Inner join - what are alternative methods in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311937#M61368</link>
    <description>&lt;P&gt;I have the following tables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have01;
infile cards truncover expandtabs;
input MC $ LC $ MCC $ MCN $ TLC $ DD $ ODS_TimeStamp ODS_LUpd zTPl $ PuD $;
cards;
1853 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
1856 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
1869 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
2024 DV16 1 Vetu SM3 2008-01-31 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 47 .
2025 DV16 1 Vetu SM3 2008-01-31 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 47 .
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might have to format date column in the above table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have02;
infile cards truncover expandtabs;
input WPMVId ToSTimeStamp TId ASN WC $ CWC $ TSide $ MNo Y X;
cards;
1 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 1 -82140 2468
2 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 2 -81940 2466
3 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 3 -81739 2463
4 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 4 -81539 2459
5 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 5 -81339 2456
6 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 6 -81139 2453
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might have to format date column in the above table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me using some alternative to SQL code above, specifically when I have issue that my Table 2 above is almost 0.8 billion rows data and it takes hell a lot time to run SQL query as above.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2016 09:07:31 GMT</pubDate>
    <dc:creator>imanojkumar1</dc:creator>
    <dc:date>2016-11-16T09:07:31Z</dc:date>
    <item>
      <title>SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311681#M61348</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I want to do is to find an alternative to the following code:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
       CREATE TABLE WORK.XX AS
       SELECT DISTINCT t2.WC, t2.CWC
          FROM WORK.YY t1
               INNER JOIN WORK.ZZ t2 ON (t1.MC = t2.WC)
    ;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Could someone please help in doing the same thing using hash or any other method?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311681#M61348</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-15T14:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311683#M61349</link>
      <description>&lt;P&gt;If there is a 1(YY) to n(ZZ) relation, then&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.xx;
merge
  work.yy (in=a keep=mc rename=(mc=wc))
  work.zz (in=b keep=wc cwc)
;
by wc;
if a and b;
run;

proc sort data=work.xx nodupkey;
by wc cwc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should deliver the same result.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311683#M61349</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-15T14:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311684#M61350</link>
      <description>&lt;P&gt;Do the variables WC and CWC also exist in WORK.YY? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311684#M61350</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2016-11-15T14:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311686#M61351</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Do the variables WC and CWC also exist in WORK.YY? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Good catch. I edited my post to safeguard against that.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311686#M61351</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-15T14:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311710#M61353</link>
      <description>&lt;P&gt;XX Table has following vars:&lt;BR /&gt;MC LC MCC MCN TLC DD&lt;BR /&gt;&lt;BR /&gt;YY:&lt;BR /&gt;WC CWC TS MS Y X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where MC and WC are same datatype (char) and common values but only var names are different i.e. in XX it is MC and in YY it is WC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CWC is only in YY and not in XX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 14:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311710#M61353</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-15T14:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311825#M61360</link>
      <description>&lt;P&gt;Many thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unfortunately, it returned me an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: BY variables are not properly sorted on data set WORK.YY&lt;BR /&gt;a=1 b=1 WC=7507 CWC=&amp;nbsp; FIRST.WC=0 LAST.WC=1 _ERROR_=1 _N_=585904753&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 19:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311825#M61360</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-15T19:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311830#M61361</link>
      <description>&lt;P&gt;Then you need to sort your datasets by the variables that are used in the merge.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 19:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311830#M61361</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-15T19:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311906#M61365</link>
      <description>That's a quite neat SQL,  why do you need an alternative?</description>
      <pubDate>Wed, 16 Nov 2016 05:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311906#M61365</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-11-16T05:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311937#M61368</link>
      <description>&lt;P&gt;I have the following tables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have01;
infile cards truncover expandtabs;
input MC $ LC $ MCC $ MCN $ TLC $ DD $ ODS_TimeStamp ODS_LUpd zTPl $ PuD $;
cards;
1853 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
1856 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
1869 DR14 1 Vetu SM3 . 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 0 .
2024 DV16 1 Vetu SM3 2008-01-31 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 47 .
2025 DV16 1 Vetu SM3 2008-01-31 24SEP2013:10:06:53.580 20JUL2016:12:55:39.240 47 .
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might have to format date column in the above table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have02;
infile cards truncover expandtabs;
input WPMVId ToSTimeStamp TId ASN WC $ CWC $ TSide $ MNo Y X;
cards;
1 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 1 -82140 2468
2 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 2 -81940 2466
3 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 3 -81739 2463
4 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 4 -81539 2459
5 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 5 -81339 2456
6 21AUG2012:17:57:39.000 20949 1 7604 HPUS230 R 6 -81139 2453
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might have to format date column in the above table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me using some alternative to SQL code above, specifically when I have issue that my Table 2 above is almost 0.8 billion rows data and it takes hell a lot time to run SQL query as above.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 09:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311937#M61368</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-16T09:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311938#M61369</link>
      <description>These are relatively large tables. sorting might take a long time. I am providing a sample data in a reply in the trailing communication (please see below). Thanks.</description>
      <pubDate>Wed, 16 Nov 2016 09:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311938#M61369</guid>
      <dc:creator>imanojkumar1</dc:creator>
      <dc:date>2016-11-16T09:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311954#M61371</link>
      <description>&lt;P&gt;The solution depends very much on the size(s). If one of the tables fits into MEMSIZE, creating a format or using a hash object can speed your process up.&lt;/P&gt;
&lt;P&gt;If that is not the case, you will have to sort the tables for the merge. In my experience, using explicit sorts and a merge will out-perform SQL when the contributing tables grow large&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 11:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/311954#M61371</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-16T11:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS proc SQL and Inner join - what are alternative methods</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/312030#M61374</link>
      <description>But how large is t1?&lt;BR /&gt;Are the tables by any chance indexed on MC/WC respectively? &lt;BR /&gt;And how large/small does t1 subsets t2 aproxmately? &lt;BR /&gt;Unless small sub with indexes hash table or user def format are your best shots.</description>
      <pubDate>Wed, 16 Nov 2016 16:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-proc-SQL-and-Inner-join-what-are-alternative-methods/m-p/312030#M61374</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-11-16T16:30:12Z</dc:date>
    </item>
  </channel>
</rss>

