<?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 How to compare 4 columns in two tables ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906453#M357929</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables with identical columns A, B, C, D, E, F.&lt;/P&gt;&lt;P&gt;T1 has 2000 values&amp;nbsp;&lt;/P&gt;&lt;P&gt;T2 has 5300 values&lt;/P&gt;&lt;P&gt;These two tables have 4 primary keys: A,C,D,F.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want to create a new table and take values from T2 where A,C,D,F are not present in T1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I proceed please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried proc sql 'except', but it is comparing all columns in both tables&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 14:33:25 GMT</pubDate>
    <dc:creator>MILKYLOVE</dc:creator>
    <dc:date>2023-12-06T14:33:25Z</dc:date>
    <item>
      <title>How to compare 4 columns in two tables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906453#M357929</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables with identical columns A, B, C, D, E, F.&lt;/P&gt;&lt;P&gt;T1 has 2000 values&amp;nbsp;&lt;/P&gt;&lt;P&gt;T2 has 5300 values&lt;/P&gt;&lt;P&gt;These two tables have 4 primary keys: A,C,D,F.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I want to create a new table and take values from T2 where A,C,D,F are not present in T1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I proceed please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried proc sql 'except', but it is comparing all columns in both tables&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 14:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906453#M357929</guid>
      <dc:creator>MILKYLOVE</dc:creator>
      <dc:date>2023-12-06T14:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 4 columns in two tables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906458#M357932</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data T1 T2;
input A B C D E F;
if mod(_N_,2) then output T1;
output T2;
cards;
1 2 3 4 5 6
2 3 4 5 6 7
3 4 5 6 7 8
4 5 6 7 8 9
5 6 7 8 9 0
;
run;


proc sql;
select A,C,D,F from T2
except
select A,C,D,F from T1
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 14:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906458#M357932</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-06T14:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 4 columns in two tables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906461#M357934</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need all the columns A,B,C,D,E,F in the output table. But I need to compare only the four primary keys A,C,D,F.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 14:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906461#M357934</guid>
      <dc:creator>MILKYLOVE</dc:creator>
      <dc:date>2023-12-06T14:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 4 columns in two tables ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906464#M357936</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from T2
natural inner join
(
select A,C,D,F from T2
except
select A,C,D,F from T1
)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Dec 2023 15:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-4-columns-in-two-tables/m-p/906464#M357936</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-12-06T15:01:59Z</dc:date>
    </item>
  </channel>
</rss>

