<?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: HOW TO REMOVE ID BASED ON ONE VALUE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832280#M328949</link>
    <description>&lt;P&gt;Here is how I interpret your needs:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to remove the entire ID group if one or more observations within that group has indication = 'B'. Correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is exactly what my code does, both in the previous example and in this one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the posted results as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Indication $;
datalines;
1 A
1 B
1 A
1 B
2 C
2 C
2 C
2 C
3 A
3 B
3 C
3 D
4 A
4 C
4 D
4 E
;

proc sql;
   create table want as
   select * from have
   group by ID
   having(sum(indication = 'B') = 0)
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID  Indication
2   C
2   C
2   C
2   C
4   D
4   C
4   A
4   E&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Sep 2022 09:33:27 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-09-08T09:33:27Z</dc:date>
    <item>
      <title>HOW TO REMOVE ID BASED ON ONE VALUE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832273#M328946</link>
      <description>&lt;P&gt;Dear community ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need your help. I have a dataset like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp;indication&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;I would like to remove ID were indication = B&amp;nbsp; like the output below:&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 08:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832273#M328946</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2022-09-08T08:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO REMOVE ID BASED ON ONE VALUE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832274#M328947</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID indication $;
datalines;
1 A
1 B
1 A
1 A
2 A
2 A
2 A
2 A
;

proc sql;
   create table want as
   select * from have
   group by ID
   having(sum(indication = 'B') = 0)
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID  indication
2   A
2   A
2   A
2   A&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 09:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832274#M328947</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-08T09:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO REMOVE ID BASED ON ONE VALUE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832279#M328948</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you but it did not work . Indeed my column Indication have the value A, B ,C, D , E .&lt;/P&gt;
&lt;P&gt;The program you proposed removed all observation even if ID not equal to B.&lt;/P&gt;
&lt;P&gt;For exemple here , the ID 1 and 3 should be deleted and keep ID 2 and 4.&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 124pt;" border="0" width="166" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="83" height="19" class="xl63" style="height: 14.4pt; width: 62pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="83" class="xl63" style="width: 62pt;"&gt;Indication&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl64"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl64"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl64"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl64"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl64"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl64"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl64"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl64"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl64" style="height: 14.4pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl64"&gt;D&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;D&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;E&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 09:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832279#M328948</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2022-09-08T09:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO REMOVE ID BASED ON ONE VALUE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832280#M328949</link>
      <description>&lt;P&gt;Here is how I interpret your needs:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to remove the entire ID group if one or more observations within that group has indication = 'B'. Correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is exactly what my code does, both in the previous example and in this one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the posted results as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Indication $;
datalines;
1 A
1 B
1 A
1 B
2 C
2 C
2 C
2 C
3 A
3 B
3 C
3 D
4 A
4 C
4 D
4 E
;

proc sql;
   create table want as
   select * from have
   group by ID
   having(sum(indication = 'B') = 0)
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID  Indication
2   C
2   C
2   C
2   C
4   D
4   C
4   A
4   E&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 09:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832280#M328949</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-08T09:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: HOW TO REMOVE ID BASED ON ONE VALUE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832282#M328951</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works. Thank you so much !&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2022 10:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/HOW-TO-REMOVE-ID-BASED-ON-ONE-VALUE/m-p/832282#M328951</guid>
      <dc:creator>ndamo</dc:creator>
      <dc:date>2022-09-08T10:02:34Z</dc:date>
    </item>
  </channel>
</rss>

