<?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: Finding differeing observations between two tables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337543#M63071</link>
    <description>&lt;P&gt;Are you simply trying to see which &lt;EM&gt;observations&lt;/EM&gt; are in one and and not in the other? If so, then this would work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table differing as
select *, 'In A, not in B' as Note
from a
where schcode not in (select schcode from b)
union
select *, 'In B, not in A' as Note
from b
where schcode not in (select schcode from a);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're trying to column compare values as well, then proc compare is the way to go.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 20:18:23 GMT</pubDate>
    <dc:creator>nehalsanghvi</dc:creator>
    <dc:date>2017-03-02T20:18:23Z</dc:date>
    <item>
      <title>Finding differeing observations between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337538#M63069</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two sas&amp;nbsp;tables and am trying figure out which observations between the two tables are different.&lt;/P&gt;
&lt;P&gt;I don't know if table a has observations table b doesn't have and vice versa.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I do that?&amp;nbsp; They differ by the identifying variable schcode&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;create&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;table&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;differing &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;as&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;select&lt;/FONT&gt; a&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;*&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;left&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;join&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;b &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;on&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a.schcode=b.schcode;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 20:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337538#M63069</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2017-03-02T20:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Finding differeing observations between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337539#M63070</link>
      <description>&lt;P&gt;Take a look at PROC COMPARE. It's an excellent option for&amp;nbsp;comparing observations between two SAS data sets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#n1nwxbchh5hpu1n1h28kmici2awd.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#n1nwxbchh5hpu1n1h28kmici2awd.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 20:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337539#M63070</guid>
      <dc:creator>jhlaramore</dc:creator>
      <dc:date>2017-03-02T20:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Finding differeing observations between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337543#M63071</link>
      <description>&lt;P&gt;Are you simply trying to see which &lt;EM&gt;observations&lt;/EM&gt; are in one and and not in the other? If so, then this would work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table differing as
select *, 'In A, not in B' as Note
from a
where schcode not in (select schcode from b)
union
select *, 'In B, not in A' as Note
from b
where schcode not in (select schcode from a);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're trying to column compare values as well, then proc compare is the way to go.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 20:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337543#M63071</guid>
      <dc:creator>nehalsanghvi</dc:creator>
      <dc:date>2017-03-02T20:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Finding differeing observations between two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337658#M63079</link>
      <description>&lt;P&gt;Thank you everyone :)!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 23:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Finding-differeing-observations-between-two-tables/m-p/337658#M63079</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2017-03-02T23:04:01Z</dc:date>
    </item>
  </channel>
</rss>

