<?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: IndexC Function arguments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515563#M139125</link>
    <description>&lt;P&gt;Read the manual:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n04ha26lk1sr1in1043awq6wav80.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n04ha26lk1sr1in1043awq6wav80.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Particularly:&lt;/P&gt;
&lt;H2 class="xis-title"&gt;Details&lt;/H2&gt;
&lt;DIV class="xis-topicContent"&gt;&lt;A id="p0pzqsphjfwuj3n1eupviwz7b0fi" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paragraph"&gt;&lt;A id="n171keuz2647cqn1fyxp6k2q23o9" target="_blank"&gt;&lt;/A&gt;The INDEXC function searches&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;, from left to right, for the first occurrence of any character present in the excerpts and returns the position in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of that character. If none of the characters in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;excerpt-1&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;through&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;excerpt-n&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are found, INDEXC returns a value of 0.&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;So indexc will return the position of the first&amp;nbsp;&lt;U&gt;character&lt;/U&gt; from your list, not the whole string.&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;Use index for this:&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0vxokxhv8lr84n10nrbnzp7gnba.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0vxokxhv8lr84n10nrbnzp7gnba.htm&lt;/A&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 23 Nov 2018 14:39:14 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-11-23T14:39:14Z</dc:date>
    <item>
      <title>IndexC Function arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515556#M139119</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to &lt;SPAN&gt;K&lt;/SPAN&gt;now the position of first occurence of '~LX' or '~HL' or '~SE' whichever comes first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't now why the code is not Wor&lt;SPAN&gt;K&lt;/SPAN&gt;ing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will really appreciate your help.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data s1;&lt;BR /&gt;input string :$2000.;&lt;BR /&gt;Datalines;&lt;BR /&gt;SV1*HC+99348+LM*25+KX++++CARE*84*UN*1*12**1~DTP*472*RD8*20180720-20180720~LX*1~&lt;BR /&gt;SV1*HC+11721+59+~HL*1~*Q8+XX++CARE*47*UN*1*~LX*1~*12**2+3~DTP*472*RD8*20180720-20180720~REF*6R*2~&lt;BR /&gt;SV1*HC+11057+Q8+JX++~HL*+LX+CARE*70*UN*1*12**4+1~DTP*472*RD8*~LX*4~20180720-20180720~REF&lt;BR /&gt;SV1*HC+~SE+99213+LX+~SE+++CARE*150*UN*1*11**1+2~DTP*472*RD8*~LX*2~*20181004-20181004~REF*&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data s2;&lt;BR /&gt;set s1;&lt;BR /&gt;word1= indexc(String,'~LX', '~HL','SE') ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515556#M139119</guid>
      <dc:creator>athapa1183</dc:creator>
      <dc:date>2018-11-23T14:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: IndexC Function arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515563#M139125</link>
      <description>&lt;P&gt;Read the manual:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n04ha26lk1sr1in1043awq6wav80.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n04ha26lk1sr1in1043awq6wav80.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Particularly:&lt;/P&gt;
&lt;H2 class="xis-title"&gt;Details&lt;/H2&gt;
&lt;DIV class="xis-topicContent"&gt;&lt;A id="p0pzqsphjfwuj3n1eupviwz7b0fi" target="_blank"&gt;&lt;/A&gt;
&lt;DIV class="xis-paragraph"&gt;&lt;A id="n171keuz2647cqn1fyxp6k2q23o9" target="_blank"&gt;&lt;/A&gt;The INDEXC function searches&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;, from left to right, for the first occurrence of any character present in the excerpts and returns the position in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of that character. If none of the characters in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;excerpt-1&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;through&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;excerpt-n&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are found, INDEXC returns a value of 0.&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;So indexc will return the position of the first&amp;nbsp;&lt;U&gt;character&lt;/U&gt; from your list, not the whole string.&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;Use index for this:&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0vxokxhv8lr84n10nrbnzp7gnba.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0vxokxhv8lr84n10nrbnzp7gnba.htm&lt;/A&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515563#M139125</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-11-23T14:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: IndexC Function arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515565#M139126</link>
      <description>&lt;P&gt;INDEXC is used to get the position of a &lt;STRONG&gt;character&lt;/STRONG&gt; in a string.&lt;/P&gt;
&lt;P&gt;You may enter a list of characters to search for if any is found the position of first of them will be in result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As same line may have any searched string more than once you must check each separately.&lt;/P&gt;
&lt;P&gt;That can be done either by INDEX() or by FIND() functions.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
       pos1 = index(string,'~LX');
       pos2 = index(string,'~HL');&lt;BR /&gt;       pos3 = index(string,'SE');
       .....&lt;BR /&gt;       word = min(pos1-pos3);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are looking for first '~' character you can use INDEX / INDEXC / FIND functions;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;word = indexc(string,'~');&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515565#M139126</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-23T14:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: IndexC Function arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515730#M139213</link>
      <description>I really appreciate your help.</description>
      <pubDate>Sat, 24 Nov 2018 17:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IndexC-Function-arguments/m-p/515730#M139213</guid>
      <dc:creator>athapa1183</dc:creator>
      <dc:date>2018-11-24T17:25:11Z</dc:date>
    </item>
  </channel>
</rss>

