<?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: Checking for Duplicates using multiple variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733983#M28604</link>
    <description>&lt;P&gt;Ah got it - thanks for explaining the switch to having and the calculated part!&amp;nbsp; This was super helpful!!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 22:03:05 GMT</pubDate>
    <dc:creator>spayne16</dc:creator>
    <dc:date>2021-04-14T22:03:05Z</dc:date>
    <item>
      <title>Checking for Duplicates using multiple variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733971#M28598</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm a very new user attempting to move some of my work from SQL to SAS.&amp;nbsp; One thing I constantly do is check for duplicates.&amp;nbsp; In this example, I'm trying to create a table with the fields MedGroup, RGN_CD, CLM_NB, and a count of the CLM_NB field I call CLMCount.&amp;nbsp; I only want to see rows where the CLMCount is greater than 1.&amp;nbsp; Basically, does this Claim Number show up on multiple lines with the same MedGroup and RGN_CD?&amp;nbsp; SAS is not recognizing the CLMCount that I reference later on.&amp;nbsp; I'm fine using a proc freq or any other command to get this, but nothing I try seems to make it work (and I'm an extreme novice). Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Sql;
Create Table PROF_Dup_Test as
Select MedGroup, RGN_CD, CLM_NB, Count(CLM_NB) as CLMCount
From PROF_Grouped
Where CLMCount&amp;gt;1
Group By MedGroup, RGN_CD, CLM_NB
Order by CLMCount desc;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Apr 2021 21:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733971#M28598</guid>
      <dc:creator>spayne16</dc:creator>
      <dc:date>2021-04-14T21:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for Duplicates using multiple variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733978#M28600</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Sql;
  Create Table PROF_Dup_Test as
  Select MedGroup, RGN_CD, CLM_NB, Count(CLM_NB) as CLMCount
  From PROF_Grouped
  Group By MedGroup, RGN_CD, CLM_NB
  Having CLMCount&amp;gt;1
  Order by CLMCount desc;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Apr 2021 21:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733978#M28600</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-04-14T21:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for Duplicates using multiple variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733979#M28601</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/378368"&gt;@spayne16&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;I'm a very new user attempting to move some of my work from SQL to SAS.&amp;nbsp; One thing I constantly do is check for duplicates.&amp;nbsp; In this example, I'm trying to create a table with the fields MedGroup, RGN_CD, CLM_NB, and a count of the CLM_NB field I call CLMCount.&amp;nbsp; I only want to see rows where the CLMCount is greater than 1.&amp;nbsp; Basically, does this Claim Number show up on multiple lines with the same MedGroup and RGN_CD?&amp;nbsp; SAS is not recognizing the CLMCount that I reference later on.&amp;nbsp; I'm fine using a proc freq or any other command to get this, but nothing I try seems to make it work (and I'm an extreme novice). Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Sql;
Create Table PROF_Dup_Test as
Select MedGroup, RGN_CD, CLM_NB, Count(CLM_NB) as CLMCount
From PROF_Grouped
Where CLMCount&amp;gt;1
Group By MedGroup, RGN_CD, CLM_NB
Order by CLMCount desc;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;Proc Sql;
   Create Table PROF_Dup_Test as
   Select MedGroup, RGN_CD, CLM_NB, Count(CLM_NB) as CLMCount
   From PROF_Grouped
   Group By MedGroup, RGN_CD, CLM_NB
   Having calculated CLMCount&amp;gt;1
   Order by CLMCount desc;
Quit;&lt;/PRE&gt;
&lt;P&gt;The Calculated may not be needed but is often needed for something calculated in a proc step.&lt;/P&gt;
&lt;P&gt;The HAVING is needed instead of Where to get something related to the "group by"&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 21:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733979#M28601</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-14T21:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for Duplicates using multiple variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733981#M28602</link>
      <description>&lt;P&gt;That worked perfectly!&amp;nbsp; Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 22:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733981#M28602</guid>
      <dc:creator>spayne16</dc:creator>
      <dc:date>2021-04-14T22:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for Duplicates using multiple variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733983#M28604</link>
      <description>&lt;P&gt;Ah got it - thanks for explaining the switch to having and the calculated part!&amp;nbsp; This was super helpful!!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 22:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Checking-for-Duplicates-using-multiple-variables/m-p/733983#M28604</guid>
      <dc:creator>spayne16</dc:creator>
      <dc:date>2021-04-14T22:03:05Z</dc:date>
    </item>
  </channel>
</rss>

