<?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 use %index to get the position of bracket? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68345#M14806</link>
    <description>&amp;gt; The index function looks for the second argument&lt;BR /&gt;
&amp;gt; exactly not as individual characters.  For that you&lt;BR /&gt;
&amp;gt; need the INDEXC function.  Try: &lt;BR /&gt;
&amp;gt; [pre]%let x = a(b);&lt;BR /&gt;
&amp;gt; %put %sysfunc(indexc(&amp;amp;x,()));&lt;BR /&gt;
&amp;gt; [/pre]&lt;BR /&gt;
&amp;gt; Of course the parentheses are a particularly&lt;BR /&gt;
&amp;gt; unfortunate character to have to work with.&lt;BR /&gt;
&lt;BR /&gt;
Oh...yes. %index finds string not characters from given string. I was supposed to know this......a bit dizzy&lt;BR /&gt;
Thanks a lot.</description>
    <pubDate>Mon, 30 Aug 2010 07:55:57 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-08-30T07:55:57Z</dc:date>
    <item>
      <title>how to use %index to get the position of bracket?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68342#M14803</link>
      <description>Please see the following code, can anyone tell me why put 0 since &amp;amp;x does contain the brackets?  &lt;BR /&gt;
&lt;BR /&gt;
%let x = a(b); &lt;BR /&gt;
%put %index(&amp;amp;x, ());&lt;BR /&gt;
&lt;BR /&gt;
I want to use the code like this in macros, and how to check if a string contains brackets?&lt;BR /&gt;
%* if brackets contained, then ... ;&lt;BR /&gt;
%if %index(&amp;amp;x, ()) %then ...</description>
      <pubDate>Mon, 30 Aug 2010 04:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68342#M14803</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-30T04:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to use %index to get the position of bracket?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68343#M14804</link>
      <description>Please read the section on Macro Quoting in and around e.g. &lt;A href="http://support.sas.com/onlinedoc/913/getDoc/de/mcrolref.hlp/a001061290.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/de/mcrolref.hlp/a001061290.htm&lt;/A&gt;</description>
      <pubDate>Mon, 30 Aug 2010 06:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68343#M14804</guid>
      <dc:creator>Robert_Bardos</dc:creator>
      <dc:date>2010-08-30T06:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to use %index to get the position of bracket?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68344#M14805</link>
      <description>The index function looks for the second argument exactly not as individual characters.  For that you need the INDEXC function.  Try: &lt;BR /&gt;
[pre]%let x = a(b);&lt;BR /&gt;
%put %sysfunc(indexc(&amp;amp;x,()));&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Of course the parentheses are a particularly unfortunate character to have to work with.</description>
      <pubDate>Mon, 30 Aug 2010 07:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68344#M14805</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-08-30T07:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to use %index to get the position of bracket?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68345#M14806</link>
      <description>&amp;gt; The index function looks for the second argument&lt;BR /&gt;
&amp;gt; exactly not as individual characters.  For that you&lt;BR /&gt;
&amp;gt; need the INDEXC function.  Try: &lt;BR /&gt;
&amp;gt; [pre]%let x = a(b);&lt;BR /&gt;
&amp;gt; %put %sysfunc(indexc(&amp;amp;x,()));&lt;BR /&gt;
&amp;gt; [/pre]&lt;BR /&gt;
&amp;gt; Of course the parentheses are a particularly&lt;BR /&gt;
&amp;gt; unfortunate character to have to work with.&lt;BR /&gt;
&lt;BR /&gt;
Oh...yes. %index finds string not characters from given string. I was supposed to know this......a bit dizzy&lt;BR /&gt;
Thanks a lot.</description>
      <pubDate>Mon, 30 Aug 2010 07:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68345#M14806</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-30T07:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to use %index to get the position of bracket?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68346#M14807</link>
      <description>Try looking for them separately, e.g. find the first one...&lt;BR /&gt;
&lt;BR /&gt;
12   %let q = %str(%();&lt;BR /&gt;
13   %put &amp;amp;q;&lt;BR /&gt;
(&lt;BR /&gt;
14   %let x = a(b);&lt;BR /&gt;
15   %put %index(&amp;amp;x, &amp;amp;q);&lt;BR /&gt;
2</description>
      <pubDate>Mon, 13 Dec 2010 16:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-index-to-get-the-position-of-bracket/m-p/68346#M14807</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2010-12-13T16:42:49Z</dc:date>
    </item>
  </channel>
</rss>

