<?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: Duplicate value within by group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248706#M46728</link>
    <description>&lt;PRE&gt;proc sort data=have nodupkey dupout=dups;
  by id subject;
run;&lt;/PRE&gt;</description>
    <pubDate>Mon, 08 Feb 2016 16:44:12 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2016-02-08T16:44:12Z</dc:date>
    <item>
      <title>Duplicate value within by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248692#M46724</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Can someone tell me how to get the duplicate value within by group. Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp; Subject&lt;/P&gt;
&lt;P&gt;100 &amp;nbsp; English&lt;/P&gt;
&lt;P&gt;100&lt;SPAN&gt; &amp;nbsp; Math&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;100 &amp;nbsp; Biology&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp; English&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;111 &amp;nbsp;&amp;nbsp;Biology&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp; Math&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp; Math&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp;Biology&lt;/P&gt;
&lt;P&gt;112 &amp;nbsp;Chemistry&lt;/P&gt;
&lt;P&gt;112&lt;SPAN&gt; &amp;nbsp; English&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;112 &amp;nbsp; Physics&lt;/P&gt;
&lt;P&gt;112 &amp;nbsp; Math&lt;/P&gt;
&lt;P&gt;112&lt;SPAN&gt; &amp;nbsp; English&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Outpu table will be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp; Subject&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;111 &amp;nbsp;&amp;nbsp;Biology&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp; Biology&lt;/P&gt;
&lt;P&gt;112&lt;SPAN&gt; &amp;nbsp; English&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;112&lt;SPAN&gt; &amp;nbsp; English&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248692#M46724</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-02-08T16:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate value within by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248697#M46725</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
by id subject;
run;

data dups;
set have;
by id subject;
if not (first.subject and last.subject) then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248697#M46725</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-08T16:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate value within by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248706#M46728</link>
      <description>&lt;PRE&gt;proc sort data=have nodupkey dupout=dups;
  by id subject;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248706#M46728</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-02-08T16:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate value within by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248708#M46729</link>
      <description>&lt;P&gt;Or:&lt;/P&gt;
&lt;PRE&gt;proc sort data=have out=nondups dupout=want nodupkey;
  by id subject;
run;&lt;/PRE&gt;
&lt;P&gt;This will give you a dataset want which has all the duplicate values, you can sort it again nodupkey to get distinct values, also you do:&lt;/P&gt;
&lt;PRE&gt;proc sql;&lt;BR /&gt; create table WANT as&lt;BR /&gt; select distinct ID,SUBJECT&lt;BR /&gt; from HAVE&lt;BR /&gt; group by ID,SUBJECT&lt;BR /&gt; having count(*) &amp;gt; 1;&lt;BR /&gt;quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248708#M46729</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-08T16:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate value within by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248709#M46730</link>
      <description>&lt;P&gt;Proc Sort identifies one of the duplicate records not both. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to identify both using PROC SORT use the NOUNIQUEKEY option instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have nouniquekey out=want;
  by id subject;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Duplicate-value-within-by-group/m-p/248709#M46730</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-08T16:53:26Z</dc:date>
    </item>
  </channel>
</rss>

