<?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: How to append data and  remove duplicates in SAS with some constraints in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168281#M12926</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, it should have one 3 only.&lt;/P&gt;&lt;P&gt;Also there are other variables, but they are descriptive, no decision is made based on those variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 May 2014 20:19:56 GMT</pubDate>
    <dc:creator>eagles_dare13</dc:creator>
    <dc:date>2014-05-21T20:19:56Z</dc:date>
    <item>
      <title>How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168277#M12922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a data set A which has values like:&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;5&lt;/P&gt;&lt;P&gt;(a.k.a some values are repeating)&lt;/P&gt;&lt;P&gt;I have another data set B with values like:&lt;/P&gt;&lt;P&gt;1&lt;BR /&gt;3&lt;BR /&gt;3&lt;BR /&gt;5&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;8&lt;/P&gt;&lt;P&gt;(a.k.a some values are repeating , some values are also in A, and some are new)&lt;/P&gt;&lt;P&gt;I want to create a dataset C such that it has every value from A and only those from B that are not in A.&lt;BR /&gt;So the final should look like:&lt;/P&gt;&lt;P&gt;1&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;5&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;8&lt;/P&gt;&lt;P&gt;So in short, duplicates within the same set are to be retained but if there is a duplicate across A and B, only retain the one from A. There is also a description column that says whether the value is in A or B.&lt;/P&gt;&lt;P&gt;How to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 19:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168277#M12922</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-05-21T19:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168278#M12923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What about a case where A has&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and B has&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should your result have one 3 or two 3's?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, do you need any other variables copied across, or only this one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 19:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168278#M12923</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-05-21T19:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168279#M12924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It may be short but it's not that simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; from_a=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; merge a (in=from_a) b (in=from_b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by value;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.value then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if from_a and from_b then source='Both A and B';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if from_a then source='A only';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else source='B only';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; retain source;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if source='B only' then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else if from_a then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 20:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168279#M12924</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-05-21T20:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168280#M12925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;DATA A;&lt;BR /&gt;INPUT X;&lt;BR /&gt;CARDS;&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;5&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA B;&lt;BR /&gt;INPUT X;&lt;BR /&gt;CARDS;&lt;BR /&gt;1&lt;BR /&gt;3&lt;BR /&gt;3&lt;BR /&gt;5&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;8&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;&amp;nbsp; SELECT * FROM A&lt;BR /&gt;&amp;nbsp; UNION ALL&lt;BR /&gt;&amp;nbsp; SELECT * FROM B WHERE X NOT IN (SELECT * FROM A);&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 20:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168280#M12925</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2014-05-21T20:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168281#M12926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In that case, it should have one 3 only.&lt;/P&gt;&lt;P&gt;Also there are other variables, but they are descriptive, no decision is made based on those variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 20:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168281#M12926</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-05-21T20:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168282#M12927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;proc sql;
create table want as
 select * from a
&amp;nbsp; union all
( select * from b
&amp;nbsp;&amp;nbsp; except all
&amp;nbsp; select * from a)
;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 13:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168282#M12927</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-22T13:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168283#M12928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When SAS concatenates data sets with the union all statement and each data set has the exact same column names and column data types, will SAS use the ordering of the columns to figure out the corresponding columns or the actual names?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 17:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168283#M12928</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-05-22T17:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to append data and  remove duplicates in SAS with some constraints</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168284#M12929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;union all &lt;STRONG&gt;corr&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 May 2014 10:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-append-data-and-remove-duplicates-in-SAS-with-some/m-p/168284#M12929</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-24T10:35:35Z</dc:date>
    </item>
  </channel>
</rss>

