<?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 List duplicate observations? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374570#M89708</link>
    <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to list the duplicate&amp;nbsp;observations in 'Found' column.&amp;nbsp; Please advice how.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&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;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Founddup;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$80.&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;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name $ found;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If_True 1&lt;/P&gt;
&lt;P&gt;If_True_kary 1&lt;/P&gt;
&lt;P&gt;If_True_kary 1&lt;/P&gt;
&lt;P&gt;If_True_John 3&lt;/P&gt;
&lt;P&gt;If_Not 24&lt;/P&gt;
&lt;P&gt;If_Not 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_False_Joe 288&lt;/P&gt;
&lt;P&gt;If_False_Joe 288&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2017 15:55:47 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2017-07-10T15:55:47Z</dc:date>
    <item>
      <title>List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374570#M89708</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to list the duplicate&amp;nbsp;observations in 'Found' column.&amp;nbsp; Please advice how.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&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;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Founddup;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;$80.&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;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name $ found;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If_True 1&lt;/P&gt;
&lt;P&gt;If_True_kary 1&lt;/P&gt;
&lt;P&gt;If_True_kary 1&lt;/P&gt;
&lt;P&gt;If_True_John 3&lt;/P&gt;
&lt;P&gt;If_Not 24&lt;/P&gt;
&lt;P&gt;If_Not 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_Not_Carol 24&lt;/P&gt;
&lt;P&gt;If_False_Joe 288&lt;/P&gt;
&lt;P&gt;If_False_Joe 288&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 15:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374570#M89708</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-07-10T15:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374579#M89712</link>
      <description>&lt;PRE&gt;data want;
  set Founddup;
  by found notsorted;
  if not(first.found and last.found);
run;
proc print data=want;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 16:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374579#M89712</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-10T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374582#M89714</link>
      <description>&lt;P&gt;NOUNIQUEREC option in PROC SORT does exactly this. You can also use the NOUNIQUEKEY if you're looking at specific variables to identify duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*This code demonstrates how to keep only duplicate observations in a data set*/

%*Create sample data set;
data have;
informat name $80.;
input name $ found;
cards;
If_True 1
If_True_kary 1
If_True_kary 1
If_True_John 3
If_Not 24
If_Not 24
If_Not_Carol 24
If_Not_Carol 24
If_Not_Carol 24
If_False_Joe 288
If_False_Joe 288
;
run;

%*Sort with NOUNIQUEREC option;
proc sort data=have out=duplicates  nouniquerec;
by name found;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://gist.githubusercontent.com/statgeek/1ff5a4aaca9b3f875d4defdaa598ae5e/raw/87a7485a46add02b5f0f0a96f21933a3f2ebd8be/proc_sort_output_duplicates.sas" target="_blank"&gt;https://gist.githubusercontent.com/statgeek/1ff5a4aaca9b3f875d4defdaa598ae5e/raw/87a7485a46add02b5f0f0a96f21933a3f2ebd8be/proc_sort_output_duplicates.sas&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 16:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374582#M89714</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-10T16:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374602#M89718</link>
      <description>&lt;P&gt;Just curious, is there a way that sort the 'found' duplicate obs after the 'not (first and last)' statement? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 17:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374602#M89718</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-07-10T17:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374608#M89719</link>
      <description>&lt;P&gt;Not sure what you're asking. My suggestion was based on the existing order of the records. If you needed it sorted, I'd go with the&amp;nbsp;proc sort nouniquerec option that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;suggested.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 17:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374608#M89719</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-10T17:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374629#M89722</link>
      <description>&lt;P&gt;Well, the proc sort code doesn't work in my actual dataset.. Yours works.&amp;nbsp;&amp;nbsp; Basely, I would like to sort the dupicate numbers from zero to largest.&amp;nbsp; I found your code doesn't come with this function.&amp;nbsp; I need to add proc sort on more step.&amp;nbsp; I wish I could do it in one data steps.&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;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Founddup;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; found &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;notsorted&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;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; not(first.found and last.found);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&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 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;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=want; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; found; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374629#M89722</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-07-10T18:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374655#M89733</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Well, the proc sort code doesn't work in my actual dataset..&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's not clear who you're responding to, please quote the original post in your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SORT will work for your situation in a single step. If it doesn't you're doing something wrong.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 18:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374655#M89733</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-10T18:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: List duplicate observations?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374657#M89734</link>
      <description>&lt;P&gt;Couldn't you just use?:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have out=duplicates  nouniquerec;
  by found name;
run;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 19:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-duplicate-observations/m-p/374657#M89734</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-10T19:04:02Z</dc:date>
    </item>
  </channel>
</rss>

