<?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 intersect in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111059#M30795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your comments. PGStats, I have several tables I need to perform this operation on that have different columns so I think I like the idea of a NATURAL join but this leaves me with how to re-add the sequenceID column post the join. Any thoughts on how to do this last step?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Dec 2012 16:33:03 GMT</pubDate>
    <dc:creator>Mikeyjh</dc:creator>
    <dc:date>2012-12-31T16:33:03Z</dc:date>
    <item>
      <title>proc sql intersect</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111056#M30792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I have 2 tables that I would like to perform an intersect on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table intersect_AB as&lt;/P&gt;&lt;P&gt;select * from tableA&lt;/P&gt;&lt;P&gt;intersect&lt;/P&gt;&lt;P&gt;select * from tableB;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tableA and tableB are identical in structure but they both have a sequenceID column that contains a different value for otherwise equivalent rows. So for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tableA&lt;/P&gt;&lt;P&gt;col1, col2, col3 ...sequenceID&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tableB&lt;/P&gt;&lt;P&gt;col1, col2, col3 ...sequenceID&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I have is I want to exclude the sequenceID column for the purpose of the "intersect" but add it back in afterwards as I need it to sort the resulting rows. (I can re-add either the sequenceID values from tableA or tableB but I need to consistantly use either A or B.) Can anyone please suggest a way to perform this? It would be great if we could do this in SQL if possible. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 14:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111056#M30792</guid>
      <dc:creator>Mikeyjh</dc:creator>
      <dc:date>2012-12-31T14:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql intersect</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111057#M30793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure how you will add sequenceID&amp;nbsp; back, but for the first step of intersect, try this:&lt;/P&gt;&lt;P&gt;create table intersect_AB as&lt;/P&gt;&lt;P&gt;select * from tableA(drop=sequenceID)&lt;/P&gt;&lt;P&gt;intersect&lt;/P&gt;&lt;P&gt;select * from tableB (drop=sequenceID) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 15:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111057#M30793</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-12-31T15:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql intersect</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111058#M30794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is simpler to do this as a JOIN (you can sort at the same time) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;create table tableC as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select A.* &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;from &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableA as A inner join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableB as B on A.col1=B.col1 and A.col2=B.col2 and A.col3=B.col3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;order by A.sequenceId;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't want to have to name the variables (col1..) then you could exclude sequenceId from tableB and use a NATURAL join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 16:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111058#M30794</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-12-31T16:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql intersect</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111059#M30795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your comments. PGStats, I have several tables I need to perform this operation on that have different columns so I think I like the idea of a NATURAL join but this leaves me with how to re-add the sequenceID column post the join. Any thoughts on how to do this last step?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 16:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111059#M30795</guid>
      <dc:creator>Mikeyjh</dc:creator>
      <dc:date>2012-12-31T16:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql intersect</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111060#M30796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this would work :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;create table tableC as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select tableA.* &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;from &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableA natural join&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tableB(drop=sequenceId)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;order by tableA.sequenceId&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 19:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql-intersect/m-p/111060#M30796</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-12-31T19:09:46Z</dc:date>
    </item>
  </channel>
</rss>

