<?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 Delete a multiple values in a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740726#M231436</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple values on the column CODES and need to delete some of them which has 101,102,103,104,1110,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prov &amp;nbsp;&amp;nbsp;Codes&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;101, 102,103,104,007&lt;/LI&gt;&lt;LI&gt;101, 102,103,104,1110 ,007,008&lt;/LI&gt;&lt;LI&gt;108,109,1110,1111&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prov &amp;nbsp;&amp;nbsp;Codes&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;007&lt;/LI&gt;&lt;LI&gt;007,008&lt;/LI&gt;&lt;LI&gt;1111&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
    <pubDate>Wed, 12 May 2021 05:59:11 GMT</pubDate>
    <dc:creator>cho16</dc:creator>
    <dc:date>2021-05-12T05:59:11Z</dc:date>
    <item>
      <title>Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740726#M231436</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple values on the column CODES and need to delete some of them which has 101,102,103,104,1110,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prov &amp;nbsp;&amp;nbsp;Codes&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;101, 102,103,104,007&lt;/LI&gt;&lt;LI&gt;101, 102,103,104,1110 ,007,008&lt;/LI&gt;&lt;LI&gt;108,109,1110,1111&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prov &amp;nbsp;&amp;nbsp;Codes&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;007&lt;/LI&gt;&lt;LI&gt;007,008&lt;/LI&gt;&lt;LI&gt;1111&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 05:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740726#M231436</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2021-05-12T05:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740728#M231438</link>
      <description>&lt;P&gt;How about this code?&lt;/P&gt;
&lt;P&gt;BTW, you have removed 108,109,1110 from 108,109,1110,1111.&lt;/P&gt;
&lt;P&gt;Isn't it correct that it should be 108,109,1111?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  length char $200;
  cnt=countw(codes,',');
  char='';
  do i=1 to cnt ;
    x=scan(codes,i);
    if x not in ('101','102','103','104','1110') then char=catx(',',char,x);
  end;
  keep char;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 06:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740728#M231438</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-05-12T06:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740731#M231439</link>
      <description>&lt;P&gt;Yes Kawakami , you are right !&lt;/P&gt;&lt;P&gt;The code works perfect.&lt;/P&gt;&lt;P&gt;btw, how to include all other columns in the below code ..got error when I tried it.&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 06:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740731#M231439</guid>
      <dc:creator>cho16</dc:creator>
      <dc:date>2021-05-12T06:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740732#M231440</link>
      <description>&lt;P&gt;Replace the keep statement with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop cnt i codes;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 May 2021 06:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740732#M231440</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-12T06:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740735#M231441</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;&amp;nbsp;pointed out.&lt;BR /&gt;Just change the keep statement to a drop statement and specify the variable that was used temporarily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 06:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740735#M231441</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-05-12T06:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a multiple values in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740737#M231443</link>
      <description>&lt;P&gt;Alternative version, not fully tested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
   set have;
   
   length reduced $ 100;
   
   codes = compress(codes);
   reduced = prxchange('s/(,?101)|(,?102)|(,?103)|(,?104)|(,?1110)//', -1, codes);
   reduced = substr(reduced, anydigit(reduced));
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 May 2021 07:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-a-multiple-values-in-a-variable/m-p/740737#M231443</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-12T07:01:53Z</dc:date>
    </item>
  </channel>
</rss>

