<?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: counting obs. that have maximum duplicate records in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139192#M11223</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The query in the first response is also doable in the "Query Builder" in exactly the same way, and you can then post-process it with additional queries, the SORT task, and the RANK task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Mar 2014 18:21:11 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2014-03-11T18:21:11Z</dc:date>
    <item>
      <title>counting obs. that have maximum duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139189#M11220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends - i have one SAS dataset with around 1/2 millions of records with some duplicate records on field &lt;STRONG&gt;SKU&lt;/STRONG&gt;. I want to know which SKU has &lt;STRONG&gt;maximum duplicate record&lt;/STRONG&gt; itself and which has &lt;STRONG&gt;minimum duplicate records&lt;/STRONG&gt; for same field, SKU?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone please tell me how can i do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 23:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139189#M11220</guid>
      <dc:creator>jimksas</dc:creator>
      <dc:date>2014-03-10T23:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: counting obs. that have maximum duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139190#M11221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table max_min as&lt;/P&gt;&lt;P&gt;select &lt;STRONG style="font-size: 12.800000190734863px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;SKU&lt;/STRONG&gt;, count(SKU) as duplicates&lt;/P&gt;&lt;P&gt;from your_table&lt;/P&gt;&lt;P&gt;group by SKU&lt;/P&gt;&lt;P&gt;having duplicates &amp;gt; 1&lt;/P&gt;&lt;P&gt;order by duplicates desc&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will get only duplicate values, unique ones will not show up.&lt;/P&gt;&lt;P&gt;First record will be SKU with maximum duplicates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 07:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139190#M11221</guid>
      <dc:creator>stataddict</dc:creator>
      <dc:date>2014-03-11T07:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: counting obs. that have maximum duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139191#M11222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Updated slightly, with this you can select any number of min/max values, in this instance I want bottom and top 2 records:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table WORK.WANT as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; *&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp; TYPE,&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; COUNT(TYPE) as COUNT_OF_TYPE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; SASHELP.CARS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by TYPE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; order by COUNT_OF_TYPE;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&amp;nbsp; COUNT(TYPE)&lt;/P&gt;&lt;P&gt;&amp;nbsp; into&amp;nbsp;&amp;nbsp;&amp;nbsp; :NUM_OBS&lt;/P&gt;&lt;P&gt;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp; WORK.WANT;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ &amp;lt;= 2 or _n_ &amp;gt; (&amp;amp;NUM_OBS. - 2) then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 09:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139191#M11222</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-03-11T09:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: counting obs. that have maximum duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139192#M11223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The query in the first response is also doable in the "Query Builder" in exactly the same way, and you can then post-process it with additional queries, the SORT task, and the RANK task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 18:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139192#M11223</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-03-11T18:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: counting obs. that have maximum duplicate records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139193#M11224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stataddict, RW9 and Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything works grt...!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also did validate number of observation using PROC REPORT. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2014 05:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/counting-obs-that-have-maximum-duplicate-records/m-p/139193#M11224</guid>
      <dc:creator>jimksas</dc:creator>
      <dc:date>2014-03-12T05:16:57Z</dc:date>
    </item>
  </channel>
</rss>

