<?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: Compare two data sets and keep only the records not in both in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117305#M24206</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please look up documentation for SQL set operators in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n0vo2lglyrnexwn14emi8m0jqvrj.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n0vo2lglyrnexwn14emi8m0jqvrj.htm"&gt;SAS(R) 9.3 SQL Procedure User's Guide&lt;/A&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>Tue, 23 Apr 2013 18:59:02 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-04-23T18:59:02Z</dc:date>
    <item>
      <title>Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117301#M24202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have two data sets, one of which is a sub-set of the other. What I would like to do is to create a third data set that contains the records that are not common to both data sets. Does anyone know of a clean way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 18:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117301#M24202</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2013-04-23T18:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117302#M24203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If dataset B is a subset of dataset A then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table A_minus_B&amp;nbsp; as&lt;/P&gt;&lt;P&gt;select * from A&lt;/P&gt;&lt;P&gt;EXCEPT&lt;/P&gt;&lt;P&gt;select * from B;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selects rows from A which do not appear in B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 18:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117302#M24203</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-23T18:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117303#M24204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This macro provides one way to do that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Macro_Extract" title="http://www.sascommunity.org/wiki/Macro_Extract"&gt;http://www.sascommunity.org/wiki/Macro_Extract&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 18:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117303#M24204</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-23T18:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117304#M24205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This statement would not work because it does not give an indicator of a column to match on? Even though the records are a sub-set, the columns are slightly different between the two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 18:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117304#M24205</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2013-04-23T18:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117305#M24206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please look up documentation for SQL set operators in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n0vo2lglyrnexwn14emi8m0jqvrj.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/63043/HTML/default/viewer.htm#n0vo2lglyrnexwn14emi8m0jqvrj.htm"&gt;SAS(R) 9.3 SQL Procedure User's Guide&lt;/A&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>Tue, 23 Apr 2013 18:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117305#M24206</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-23T18:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117306#M24207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found an answer actually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 19:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117306#M24207</guid>
      <dc:creator>Paul_NYS</dc:creator>
      <dc:date>2013-04-23T19:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117307#M24208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to know what it is. Could you please share? - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 19:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117307#M24208</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-04-23T19:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117308#M24209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see also&lt;/P&gt;&lt;P data-canvas-width="673.1332499588011" data-font-name="Helvetica" dir="ltr" style="font-size: 18.64px; font-family: sans-serif;"&gt;Using the EXCEPT Operator in PROC SQL &lt;/P&gt;&lt;P data-canvas-width="529.6063730584715" data-font-name="Helvetica" dir="ltr" style="font-size: 18.64px; font-family: sans-serif;"&gt;and Generation Data Sets to Produce a Comparison Report &lt;/P&gt;&lt;P&gt;Stanley Fogleman,&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.nesug.org/proceedings/nesug06/cc/cc10.pdf" title="http://www.nesug.org/proceedings/nesug06/cc/cc10.pdf"&gt;http://www.nesug.org/proceedings/nesug06/cc/cc10.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 11:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117308#M24209</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-24T11:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two data sets and keep only the records not in both</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117309#M24210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it this last example from the page you cited. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2 class="title"&gt;Producing Rows from the First Query or the Second Query&lt;/H2&gt;&lt;DIV class="topicContent"&gt;&lt;A name="p09tg7ysam6qrin1fspirr7jnpz6"&gt;&lt;/A&gt;&lt;DIV class="figure"&gt;&lt;A name="p0559ru0jaljpnn1d0pjmq1sa2bx"&gt;&lt;/A&gt;&lt;DIV class="graphicAndDescription"&gt;&lt;IMG alt="First or second table, but not both" class="jiveImage" src="https://communities.sas.com/images/query.png" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;&lt;A name="p0kn8m5d3l1hq1n1ku0g13t1vepf"&gt;&lt;/A&gt; There is no keyword&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in PROC SQL that returns unique rows from the first and second table,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; but not rows that occur in both.&amp;nbsp; Here is one way that you can simulate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this operation:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/DIV&gt;&lt;A name="n03zbdbj4h94obn1a55gmgpp79l5"&gt;&lt;/A&gt; &lt;PRE class="codeFragment"&gt;(query1 except query2) union (query2 except query1)&lt;/PRE&gt;&lt;DIV class="paragraph"&gt;&lt;A name="p1cwr5r9ssenxan1m12qusvxq2rr"&gt;&lt;/A&gt;This example shows how&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to use this operation.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/DIV&gt;&lt;A name="p1sjbsh8fcllutn1kv7f2nstr2hz"&gt;&lt;/A&gt;&lt;PRE class="code"&gt;proc sql; title 'A EXCLUSIVE UNION B'; (select * from sql.a except select * from sql.b) union (select * from sql.b except select * from sql.a);&lt;/PRE&gt;&lt;DIV class="outputBlock"&gt;&lt;A name="n0wwo1kfnwns6in13g6xf34646ku"&gt;&lt;/A&gt;&lt;DIV class="title"&gt;Producing Rows from the First Query or the Second Query&lt;/DIV&gt;&lt;DIV class="output"&gt;&lt;DIV class="graphicAndDescription"&gt;&lt;IMG alt="A EXCLUSIVE UNION B" class="jiveImage" src="https://communities.sas.com/images/output_3-40.png" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;&lt;A name="n0dt5wutp4i1rmn1xdwvnfpw29e8"&gt;&lt;/A&gt;The first EXCEPT returns&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; one unique row from the first table (table A) only. The second EXCEPT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returns one unique row from the second table (table B) only. The middle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNION combines the two results. Thus, this query returns the row from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the first table that is not in the second table, as well as the row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from the second table that is not in the first table.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 12:18:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-data-sets-and-keep-only-the-records-not-in-both/m-p/117309#M24210</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-04-24T12:18:37Z</dc:date>
    </item>
  </channel>
</rss>

