<?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: Remove duplicates with conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424739#M281067</link>
    <description>&lt;P&gt;Alternativly to line:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input  Group_code 1.  @-1  Group 3.  Class : $20. Component : $20. Product : $20.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input   Group  Class : $20. Component : $20. Product : $20.;

group_code = int(group/100);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Jan 2018 20:35:52 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2018-01-03T20:35:52Z</dc:date>
    <item>
      <title>Remove duplicates with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424718#M281064</link>
      <description>&lt;P&gt;&amp;nbsp;Hello:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have the sample dataset list below.&amp;nbsp; I would like to remove the duplicates of "Group" of (100, 200, 300 and 400) if I could find the&lt;BR /&gt;same text in the&amp;nbsp;subgroup of&amp;nbsp;101-199, 201-299, 301-399 or 401-499.&amp;nbsp;&amp;nbsp; Please help.&amp;nbsp;&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile datalines dsd;&lt;BR /&gt;&amp;nbsp; input Group Class : $20. Component : $20. Product : $20.;&lt;BR /&gt;datalines;&lt;BR /&gt;100, ANTI/INSULIN,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;100, ANTI/VITA,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;100, PHENAZO,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;112, ANTI/VITA,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;150, PHENAZO,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;180, PHENAZO,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;181, Large,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; HERBS,&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; PSYCH,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; BANZOCAINE,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; Large,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;210,&amp;nbsp; ,&amp;nbsp; SKIN,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;270,&amp;nbsp; ,&amp;nbsp; HERBS,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;280,&amp;nbsp; ,&amp;nbsp; BANZOCAINE,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;300,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; PHENAZO,&lt;BR /&gt;300,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; ANTI/VITA,&lt;BR /&gt;322,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; PHENAZO,&lt;BR /&gt;377,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; Large,&lt;BR /&gt;400,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; FLOWER,&lt;BR /&gt;400,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; SUBST,&lt;BR /&gt;421,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; BANZOCAINE,&lt;/P&gt;
&lt;P&gt;422,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; FLOWER,&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data final;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile datalines dsd;&lt;BR /&gt;&amp;nbsp; input Group Class : $20. Component : $20. Product : $20.;&lt;BR /&gt;datalines;&lt;BR /&gt;100, ANTI/INSULIN,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;112, ANTI/VITA,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;150, PHENAZO,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;180, PHENAZO,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;181, Large,&amp;nbsp; ,&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; PSYCH,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;200,&amp;nbsp; ,&amp;nbsp; Large,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;210,&amp;nbsp; ,&amp;nbsp; SKIN,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;270,&amp;nbsp; ,&amp;nbsp; HERBS,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;280,&amp;nbsp; ,&amp;nbsp; BANZOCAINE,&amp;nbsp;&amp;nbsp; ,&lt;BR /&gt;300,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; ANTI/VITA,&lt;BR /&gt;322,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; PHENAZO,&lt;BR /&gt;377,&amp;nbsp; ANTI/INSULIN,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; Large,&lt;BR /&gt;400,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; SUBST,&lt;BR /&gt;421,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; BANZOCAINE,&lt;/P&gt;
&lt;P&gt;422,&amp;nbsp; ,&amp;nbsp;&amp;nbsp; ,&amp;nbsp; FLOWER,&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 20:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424718#M281064</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-01-03T20:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicates with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424731#M281065</link>
      <description>Please use the code editor to include your code in posts. Otherwise it gets garbled or adds in invisible characters when you try and paste it into SAS Studio.</description>
      <pubDate>Wed, 03 Jan 2018 20:25:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424731#M281065</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-03T20:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicates with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424734#M281066</link>
      <description>&lt;P&gt;&lt;SPAN&gt;data test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile datalines dsd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; input&amp;nbsp;&amp;nbsp;Group_code 1.&amp;nbsp; @-1&amp;nbsp;&amp;nbsp;Group 3.&amp;nbsp; Class : $20. Component : $20. Product : $20.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;--- your data ---&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sort data=test; by group_code class&amp;nbsp;Component Product&amp;nbsp;; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;set test;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by group_code class Component&amp;nbsp;Product&amp;nbsp;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if first.Product and last.Product;&amp;nbsp; &amp;nbsp; /* remove duplicates */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 20:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424734#M281066</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-03T20:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove duplicates with conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424739#M281067</link>
      <description>&lt;P&gt;Alternativly to line:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input  Group_code 1.  @-1  Group 3.  Class : $20. Component : $20. Product : $20.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; input   Group  Class : $20. Component : $20. Product : $20.;

group_code = int(group/100);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 20:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-duplicates-with-conditions/m-p/424739#M281067</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-01-03T20:35:52Z</dc:date>
    </item>
  </channel>
</rss>

