<?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: Count composite character strings, in  a Macro List, that contain special character i.e. &amp;quot;_ in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366150#M87075</link>
    <description>&lt;P&gt;In the same step as you create the macro list just add:&lt;/P&gt;
&lt;PRE&gt;select count(*) from SASHELP.VTABLES
where LIBNAME="WORK" and memname like "DSN%";&lt;/PRE&gt;
&lt;P&gt;In fact, you could use the data returned from the metadata to directly work with, taking out a layer of abstraction:&lt;/P&gt;
&lt;P&gt;E.g.:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="WORK" and substr(memname,1,3)="DSN"));
  call execute('%do_somthing(indata='||strip(name)||';');
run;&lt;/PRE&gt;
&lt;P&gt;This would generate a % call for each dataset fulfilling the where clause, in your example, for example:&lt;/P&gt;
&lt;P&gt;%do_something(indata=dsn1);&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%do_something(indata=dsn2);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%do_something(indata=dsn3);&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 13:53:41 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-06-12T13:53:41Z</dc:date>
    <item>
      <title>Count composite character strings, in  a Macro List, that contain special character i.e. "_", "."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366127#M87058</link>
      <description>Dear all, I have created a macro list (using Proc Sql). The members of this macro list are "composite" character string i.e. WORK.DSN1 WORK.DSN2 WORK.DSN3 WORK.DSN4 etc. I tried to count them by using COUNTW but the result doubles the actual number ... for each "composite" string WORK.DSN1 counts both WORK and DSN1 as separate words...I would like to my composite strings to be counted once and not be separated by "." . Any hint or advice would be lore than welcome. Thank you in advance.</description>
      <pubDate>Mon, 12 Jun 2017 13:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366127#M87058</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-06-12T13:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count composite character strings, in  a Macro List, that contain special character i.e. "_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366129#M87059</link>
      <description>&lt;P&gt;Not sure if you tried to include the delimiter in countw function as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
length string $100.;
string='WORK.DSN1 WORK.DSN2 WORK.DSN3 WORK.DSN4';
c=countw(string,' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366129#M87059</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-12T13:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count composite character strings, in  a Macro List, that contain special character i.e. "_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366131#M87060</link>
      <description>&lt;P&gt;You need to give the COUNTW() function the optional third argument that specifies what charater(s) to consider the delimiter between words.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(countw(a.b c.d,%str( )));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366131#M87060</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-12T13:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count composite character strings, in  a Macro List, that contain special character i.e. "_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366132#M87061</link>
      <description>&lt;P&gt;use COUNTW function with ' ' as second&amp;nbsp;parameter&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366132#M87061</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-12T13:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count composite character strings, in  a Macro List, that contain special character i.e. "_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366150#M87075</link>
      <description>&lt;P&gt;In the same step as you create the macro list just add:&lt;/P&gt;
&lt;PRE&gt;select count(*) from SASHELP.VTABLES
where LIBNAME="WORK" and memname like "DSN%";&lt;/PRE&gt;
&lt;P&gt;In fact, you could use the data returned from the metadata to directly work with, taking out a layer of abstraction:&lt;/P&gt;
&lt;P&gt;E.g.:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="WORK" and substr(memname,1,3)="DSN"));
  call execute('%do_somthing(indata='||strip(name)||';');
run;&lt;/PRE&gt;
&lt;P&gt;This would generate a % call for each dataset fulfilling the where clause, in your example, for example:&lt;/P&gt;
&lt;P&gt;%do_something(indata=dsn1);&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%do_something(indata=dsn2);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%do_something(indata=dsn3);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 13:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366150#M87075</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-12T13:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count composite character strings, in  a Macro List, that contain special character i.e. "_</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366427#M87165</link>
      <description>Many thank to all of you for your prompt and helpful response. Unfortunately I cannot give "the solution" remark to all of the answers</description>
      <pubDate>Tue, 13 Jun 2017 08:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-composite-character-strings-in-a-Macro-List-that-contain/m-p/366427#M87165</guid>
      <dc:creator>Zeus_Olympous</dc:creator>
      <dc:date>2017-06-13T08:14:22Z</dc:date>
    </item>
  </channel>
</rss>

