<?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: what is the best way to compare two fields from two tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836937#M330926</link>
    <description>Patrick, you are right. Your query's results is exactly what I am looking for.&lt;BR /&gt;My original query took 7 hours to run and there were no records in the original data, so I made up this test data and got messed up. Thank you so much</description>
    <pubDate>Wed, 05 Oct 2022 12:46:40 GMT</pubDate>
    <dc:creator>Stalk</dc:creator>
    <dc:date>2022-10-05T12:46:40Z</dc:date>
    <item>
      <title>what is the best way to compare two fields from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836766#M330846</link>
      <description>&lt;P&gt;data t1;&lt;BR /&gt;input id1 $3. id2 $5.;&lt;BR /&gt;cards;&lt;BR /&gt;123 hkg5&lt;BR /&gt;689 yukq&lt;BR /&gt;567 khnx&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data t2;&lt;BR /&gt;input id1 $3. id2 $5.;&lt;BR /&gt;cards;&lt;BR /&gt;123 hkg5&lt;BR /&gt;569 yukq&lt;BR /&gt;567 khnt&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to get mis-matched records from t1 and t2 where the id1 is different in two tables for id2 values, In the above example I just want to retrieve &lt;STRONG&gt;567 khnt&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;what is the best way to compare two columns from two tables?&lt;/P&gt;
&lt;P&gt;trying to replicate the following query that is working fine in other application..&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;select&amp;nbsp;t1.custid,t2.custid,t2.id2,ord_date from t2 left join t1 using(id2)where t2.custid != t1.custid&lt;/STRONG&gt;&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;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 21:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836766#M330846</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2022-10-04T21:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: what is the best way to compare two fields from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836828#M330867</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/358432"&gt;@Stalk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;I want to get mis-matched records from t1 and t2 where the id1 is different in two tables for id2 values, In the above example I just want to retrieve &lt;STRONG&gt;567 khnt&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Based on the sample data you've provided the only matching row over ID2 that has different values for ID1 is as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1664925525306.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75885i26C2A86579A1781B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1664925525306.png" alt="Patrick_0-1664925525306.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select 
    t1.id1,
    t2.id1,
    t2.id2
  from t2 inner join t1
    on t2.id2=t1.id2
  where t2.id1 ne t1.id1
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 23:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836828#M330867</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-04T23:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: what is the best way to compare two fields from two tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836937#M330926</link>
      <description>Patrick, you are right. Your query's results is exactly what I am looking for.&lt;BR /&gt;My original query took 7 hours to run and there were no records in the original data, so I made up this test data and got messed up. Thank you so much</description>
      <pubDate>Wed, 05 Oct 2022 12:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-the-best-way-to-compare-two-fields-from-two-tables/m-p/836937#M330926</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2022-10-05T12:46:40Z</dc:date>
    </item>
  </channel>
</rss>

