<?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 remove all rows if duplicate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630753#M186773</link>
    <description>There used to be a UNIQUERECS option, it was removed because it was confusing and didn't work the way people expected and then they added UNIQUEOUT so I get them confused sometimes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Mon, 09 Mar 2020 20:55:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-03-09T20:55:31Z</dc:date>
    <item>
      <title>How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630743#M186765</link>
      <description>&lt;P&gt;I have a large data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PO&amp;nbsp; &amp;nbsp;Amount&amp;nbsp; &amp;nbsp;Line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1212&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1233&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 250&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1233&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 600&amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1345&amp;nbsp; &amp;nbsp; &amp;nbsp; 1520&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1350&amp;nbsp; &amp;nbsp; &amp;nbsp; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1350&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 500&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Want:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PO&amp;nbsp; &amp;nbsp;Amount&amp;nbsp; &amp;nbsp;Line&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1212&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1345&amp;nbsp; &amp;nbsp; &amp;nbsp; 1520&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know the nodupkey will remove the duplicates, however, I am trying to remove both if there are duplicate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630743#M186765</guid>
      <dc:creator>Mchan890</dc:creator>
      <dc:date>2020-03-09T20:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630746#M186767</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309734"&gt;@Mchan890&lt;/a&gt;&amp;nbsp; &amp;nbsp;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input PO   Amount   Line;
cards;
1212        300     1         
1233        250     1        
1233        600     2        
1345      1520     1        
1350      1000     2
1350        500     3
;

data want;
 set have;
 by po;
 if first.po and last.po;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;/*or*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
create table want as
select *
from have
group by po
having count(*)=1;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630746#M186767</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-09T20:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630747#M186768</link>
      <description>&lt;P&gt;PROC SORT has a &lt;STRIKE&gt;UNIQUERECS&lt;/STRIKE&gt;&amp;nbsp; UNIQUEOUT option as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: corrected, as per&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;code - which is a correct answer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630747#M186768</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-09T20:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630750#M186770</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; learned something new&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630750#M186770</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-09T20:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630751#M186771</link>
      <description>&lt;P&gt;Since you want unique values of PO then:&lt;/P&gt;
&lt;PRE&gt;data have;
   input PO   Amount   Line   ;
datalines;
1212        300     1         
1233        250     1        
1233        600     2        
1345      1520     1        
1350      1000     2
1350        500     3
;

Proc sort data=have out=have uniqueout=want nouniquekey;
   by po ;
run;&lt;/PRE&gt;
&lt;P&gt;The data set you want is the one specified by the UNIQUEOUT option and the NOUNIQUEKEY is the appropriate equivalent to NODUPEKEY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note how the data was provided as data step code so that we have something to test with.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630751#M186771</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-09T20:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630752#M186772</link>
      <description>&lt;P&gt;Hmm Okay, so it's called UNIQUEOUT . I will have to remember that. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630752#M186772</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-09T20:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630753#M186773</link>
      <description>There used to be a UNIQUERECS option, it was removed because it was confusing and didn't work the way people expected and then they added UNIQUEOUT so I get them confused sometimes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630753#M186773</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-09T20:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630754#M186774</link>
      <description>&lt;P&gt;Good point, I think it would help to keep abreast of which ones are active and not. I suppose there must be some docs, but really is confusing. Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; is very good in knowing the latest stuff in the docs&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 20:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630754#M186774</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-09T20:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630755#M186775</link>
      <description>Unfortunately the key is checking it frequently....and I don't actually use SAS day to day anymore, which is why my participation is 'lower' and declining :(. We do everything at my current shop in R.</description>
      <pubDate>Mon, 09 Mar 2020 21:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630755#M186775</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-09T21:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630757#M186776</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Since you want unique values of PO then:&lt;/P&gt;
&lt;PRE&gt;data have;
   input PO   Amount   Line   ;
datalines;
1212        300     1         
1233        250     1        
1233        600     2        
1345      1520     1        
1350      1000     2
1350        500     3
;

Proc sort data=have out=have uniqueout=want nouniquekey;
   by po ;
run;&lt;/PRE&gt;
&lt;P&gt;The data set you want is the one specified by the UNIQUEOUT option and the NOUNIQUEKEY is the appropriate equivalent to NODUPEKEY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note how the data was provided as data step code so that we have something to test with.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: OUT= data will not have the same observations, as DATA= as might be mistakenly implied by your example: &amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: normal; cursor: text; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;data=have out=have&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 21:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630757#M186776</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-03-09T21:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630761#M186778</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;There used to be a UNIQUERECS option, it was removed because it was confusing and didn't work the way people expected and then they added UNIQUEOUT so I get them confused sometimes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm glad I wasn't the only one remembering another no longer available option. I wouldn't be surprised that code would run but without the documentation I wasn't about to try.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 21:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630761#M186778</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-09T21:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630762#M186779</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Since you want unique values of PO then:&lt;/P&gt;
&lt;PRE&gt;data have;
   input PO   Amount   Line   ;
datalines;
1212        300     1         
1233        250     1        
1233        600     2        
1345      1520     1        
1350      1000     2
1350        500     3
;

Proc sort data=have out=have uniqueout=want nouniquekey;
   by po ;
run;&lt;/PRE&gt;
&lt;P&gt;The data set you want is the one specified by the UNIQUEOUT option and the NOUNIQUEKEY is the appropriate equivalent to NODUPEKEY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note how the data was provided as data step code so that we have something to test with.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: OUT= data will not have the same observations, as DATA= as might be mistakenly implied by your example: &amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: &amp;quot;HelevticaNeue-light&amp;quot;,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"&gt;data=have out=have&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I thought I was getting an error without the out=have, and probably should have named it Reduced or similar.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 21:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630762#M186779</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-09T21:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630765#M186780</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;out=_null_&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't need the dups.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 22:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630765#M186780</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-03-09T22:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove all rows if duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630791#M186787</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; Your &lt;EM&gt;lower&lt;/EM&gt; is most people's &lt;EM&gt;unattainable&lt;/EM&gt;!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 02:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-all-rows-if-duplicate/m-p/630791#M186787</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-03-10T02:15:47Z</dc:date>
    </item>
  </channel>
</rss>

