<?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 columns with characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335374#M75893</link>
    <description>Ok&lt;BR /&gt;date. Tracking col1. Col2. Col3 col4. Col5 col6 col7&lt;BR /&gt;01/01/16. 1z. $$ bag. Atm $$ { bag atm&lt;BR /&gt;Output&lt;BR /&gt;&lt;BR /&gt;Date. Tracking col2 col3. Col6. col7&lt;BR /&gt;01/01/26. 1 z Bag. Atm. Bag. Atm&lt;BR /&gt;The bag has 7 characters atm has 7 character after the word bag atm ..thanks for quick response&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 23 Feb 2017 18:39:19 GMT</pubDate>
    <dc:creator>Gil_</dc:creator>
    <dc:date>2017-02-23T18:39:19Z</dc:date>
    <item>
      <title>Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335357#M75889</link>
      <description>Hi I have a data set looks like this&lt;BR /&gt;Date Tracking. Col1 col2 col3 col4 col5 col6.col7 col8&lt;BR /&gt;01/01/16 2z. $$ bag. Atm. { BAG. STM $$ {&lt;BR /&gt;I need to remove the cold where the symbols $$ or { exist and just keep where bag and atm exist.</description>
      <pubDate>Thu, 23 Feb 2017 17:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335357#M75889</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-23T17:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335365#M75891</link>
      <description>&lt;P&gt;Please show data before and after.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 17:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335365#M75891</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-23T17:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335374#M75893</link>
      <description>Ok&lt;BR /&gt;date. Tracking col1. Col2. Col3 col4. Col5 col6 col7&lt;BR /&gt;01/01/16. 1z. $$ bag. Atm $$ { bag atm&lt;BR /&gt;Output&lt;BR /&gt;&lt;BR /&gt;Date. Tracking col2 col3. Col6. col7&lt;BR /&gt;01/01/26. 1 z Bag. Atm. Bag. Atm&lt;BR /&gt;The bag has 7 characters atm has 7 character after the word bag atm ..thanks for quick response&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Feb 2017 18:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335374#M75893</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-23T18:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335375#M75894</link>
      <description>Fyi the file is a csv</description>
      <pubDate>Thu, 23 Feb 2017 18:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335375#M75894</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-23T18:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335394#M75900</link>
      <description>&lt;P&gt;What you have and want isn't clear from what you've shown. Provide the have and want example in the form of two data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 20:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335394#M75900</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-23T20:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove columns with characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335410#M75907</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Drop columns that contain '$$' or '('

inspired by
https://goo.gl/2GydUH
https://communities.sas.com/t5/Base-SAS-Programming/Remove-columns-with-characters/m-p/335357

HAVE
====

Up to 40 obs WORK.HAVE total obs=1

Obs      DATE      TRACKING    COL1    COL2    COL3    COL4    COL5    COL6    COL7    COL8

 1     01/01/16      2z.        $$     bag.    Atm.     {      BAG.    STM      $$      {

WANT
====

Up to 40 obs WORK.WANT total obs=1

bs      DATE      TRACKING    COL2    COL3    COL5    COL6

1     01/01/16      2z.       bag.    Atm.    BAG.    STM

DETAILS
=======

  COL1='$$' so drop
  COL7='$$' so drop

WORKING CODE
============

      rc=dosubl('
       if chrs[i]="$$" then rol=catx(" ",rol,vname(chrs[i]));
       call symputx("drp",rol);

      set have(drop=&amp;amp;drp);


FULL SOLUTION
=============

Create some data;
data have;
input (Date  Tracking Col1 col2 col3 col4 col5 col6 col7 col8) ($);
cards4;
01/01/16 2z. $$ bag. Atm. { BAG. STM $$ {
;;;;
run;quit;

%symdel drp;
data want;
 if _n_=0 then do;
   rc=%sysfunc(dosubl('
    data out;
       length rol $200;
       do until (dne);
          set have end=dne;
          array chrs[*]  col:;
          do i=1 to dim(chrs);
            put chrs[i] ;
            if chrs[i]="$$" or chrs[i]="{" then rol=catx(" ",rol,vname(chrs[i]));
          end;
       end;
       call symputx("drp",rol);
       stop;
    run;quit;
 '));
 end;

 set have(drop=&amp;amp;drp);
 drop rc;

run;quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Feb 2017 20:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-columns-with-characters/m-p/335410#M75907</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-02-23T20:55:06Z</dc:date>
    </item>
  </channel>
</rss>

