<?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 Count the number of pipes within Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317181#M69401</link>
    <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted some help with getting the count of pipes '|' of a macro variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;%LET DLM_COUNT = COUNTC(&amp;amp;PLATFORM,') +1; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;PLATFORM has value like 'ABC|DEF|GHI|QWE'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i am expecting to 4 in DLM_COUNT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 02:03:58 GMT</pubDate>
    <dc:creator>SASAna</dc:creator>
    <dc:date>2016-12-07T02:03:58Z</dc:date>
    <item>
      <title>Count the number of pipes within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317181#M69401</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted some help with getting the count of pipes '|' of a macro variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;%LET DLM_COUNT = COUNTC(&amp;amp;PLATFORM,') +1; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;PLATFORM has value like 'ABC|DEF|GHI|QWE'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i am expecting to 4 in DLM_COUNT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 02:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317181#M69401</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-12-07T02:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of pipes within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317182#M69402</link>
      <description>&lt;P&gt;Countc is a regulare sas function, not a macro function.&amp;nbsp; So it has to be called via&amp;nbsp; %sysfunc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you seem to want to count WORDs, where | is the separator:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;%let&lt;/FONT&gt;&lt;FONT face="SAS Monospace"&gt; PLATFORM =ABC|DEF|GHI|QWE;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;%LET&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="SAS Monospace"&gt; DLM_COUNT = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;%sysfunc&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="SAS Monospace"&gt;(COUNTW(&amp;amp;PLATFORM,|));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;&lt;FONT color="#0000ff" face="SAS Monospace"&gt;%put&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="SAS Monospace"&gt; &amp;amp;=dlm_count; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 02:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317182#M69402</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-07T02:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of pipes within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317186#M69404</link>
      <description>&lt;P&gt;Modifying your attempt slightly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let dlm_count = %sysfunc(countc(&amp;amp;platform, |));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't test it right now, but it looks like it should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In retrospect, COUNTW&amp;nbsp;counts the number of words using pipes as delimiters. &amp;nbsp;COUNTC&amp;nbsp;counts number of pipes. &amp;nbsp;Either is possible, just pick the one that does what you need.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 02:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317186#M69404</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-07T02:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of pipes within Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317192#M69405</link>
      <description>Thanks much for the quick reply. It worked very well.</description>
      <pubDate>Wed, 07 Dec 2016 03:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-pipes-within-Macro/m-p/317192#M69405</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2016-12-07T03:21:56Z</dc:date>
    </item>
  </channel>
</rss>

