<?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 Select records with count of id &amp;gt; 1 in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174825#M3505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have a dataset named victimsummary of unique crash ID's with dr_lic_num1 being the driver's license number.&amp;nbsp; Many dr_lic_num can show up in the dataset if they are involved in more than 1 crash.&amp;nbsp; I need to filter the dataset to output the records for dr_lic_num1's that occur more than n times.&amp;nbsp; At the beginning I am starting with n = 1 then working my way up after looking at the results. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select *&lt;BR /&gt;from &lt;/P&gt;&lt;P&gt; (select ID, dr_lic_num1, count(dr_lic_num1) as freq1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from victimsummary&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by ID, dr_lic_num1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;where freq1 &amp;gt; 1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!\&lt;/P&gt;&lt;P&gt;-Charles&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Apr 2014 23:51:32 GMT</pubDate>
    <dc:creator>CharlesC</dc:creator>
    <dc:date>2014-04-09T23:51:32Z</dc:date>
    <item>
      <title>Select records with count of id &gt; 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174825#M3505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have a dataset named victimsummary of unique crash ID's with dr_lic_num1 being the driver's license number.&amp;nbsp; Many dr_lic_num can show up in the dataset if they are involved in more than 1 crash.&amp;nbsp; I need to filter the dataset to output the records for dr_lic_num1's that occur more than n times.&amp;nbsp; At the beginning I am starting with n = 1 then working my way up after looking at the results. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select *&lt;BR /&gt;from &lt;/P&gt;&lt;P&gt; (select ID, dr_lic_num1, count(dr_lic_num1) as freq1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from victimsummary&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by ID, dr_lic_num1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;where freq1 &amp;gt; 1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!\&lt;/P&gt;&lt;P&gt;-Charles&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 23:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174825#M3505</guid>
      <dc:creator>CharlesC</dc:creator>
      <dc:date>2014-04-09T23:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select records with count of id &gt; 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174826#M3506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the ID is unique per crash and you group by ID what do you expect the count to be?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 23:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174826#M3506</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-09T23:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Select records with count of id &gt; 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174827#M3507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you... deleting ID made the query run.&amp;nbsp; Thanks again for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 00:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174827#M3507</guid>
      <dc:creator>CharlesC</dc:creator>
      <dc:date>2014-04-10T00:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Select records with count of id &gt; 1</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174828#M3508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should also work for you: select dr_lic_num1, count(*) from victimsummary group by dr_lic_num1 having count(*) &amp;gt; 1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2014 02:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Select-records-with-count-of-id-gt-1/m-p/174828#M3508</guid>
      <dc:creator>skillman</dc:creator>
      <dc:date>2014-04-10T02:02:52Z</dc:date>
    </item>
  </channel>
</rss>

