<?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: Understanding FindC function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486183#M126454</link>
    <description>&lt;P&gt;Note that if you data is not using a single byte character set then you need to use KINDEXC() function.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm" target="_self"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Aug 2018 20:05:53 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-08-12T20:05:53Z</dc:date>
    <item>
      <title>Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486148#M126431</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to understand FindC function with the help of the below example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input MEDICARE_ID $ 1-64;
datalines;
_2E8⁪a
X3628970
A⁪2
_N_
_______
315
_ab12A:5
_error_
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
 set test;
whereisit=findc(trim(upcase(MEDICARE_ID)), '2');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you run the above code, i am&amp;nbsp;getting the below output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FindC.PNG" style="width: 416px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22404i24C4C217DDAF7E29/image-size/large?v=v2&amp;amp;px=999" role="button" title="FindC.PNG" alt="FindC.PNG" /&gt;&lt;/span&gt;I am fine with all the output except the 3rd one where i was expecting "2" , because 2 is at 2nd location.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, i would like to know what is wrong in my understanding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 12:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486148#M126431</guid>
      <dc:creator>shahsn11</dc:creator>
      <dc:date>2018-08-12T12:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486152#M126434</link>
      <description>&lt;P&gt;That value must have some invisible characters.&lt;/P&gt;
&lt;P&gt;Put the value using $HEX format to see what they are.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 13:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486152#M126434</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-12T13:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486172#M126445</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/219515"&gt;@shahsn11&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can be explained only if you run your test test against data different from the sample data you've presented here. When I run it against your data verbatim, I get the output just as expected - and as should be expected. The FINDC function, the way you call it, finds the leftmost occurrence of "2" in each string where "2" is present. For "A2", it returns 2. No one can help you with a problem if it cannot be replicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 17:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486172#M126445</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-08-12T17:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486174#M126447</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It could hardly be explained by the presence of invisible characters, either: The string is searched left-to-right and begins with "A2", all of whose characters are printable. Most likely, the real data are different from the sample presented in the original post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 17:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486174#M126447</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-08-12T17:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486179#M126452</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/219515"&gt;@shahsn11&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run your program and print dataset TEST1, two previously invisible characters appear in the output window. Both are displayed as question marks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Partial output:&lt;/P&gt;
&lt;PRE&gt;Obs    MEDICARE_ID                                                whereisit

 1     _2E8?a                                                         2
 2     X3628970                                                       4
 3     A?2                                                            3&lt;/PRE&gt;
&lt;P&gt;Obviously, the second occurrence has an impact on the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I copy your program into a Notepad (notepad.exe) window, save the file using UTF-8 coding and then open it in a hex editor, the above two "question marks" turn out to be &lt;EM&gt;three&lt;/EM&gt; characters each: The sequence of hex codes is E2 81 AA in both cases. This would explain exactly the result &lt;FONT face="courier new,courier"&gt;whereisit=5&lt;/FONT&gt;&amp;nbsp;for the third observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 18:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486179#M126452</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-08-12T18:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding FindC function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486183#M126454</link>
      <description>&lt;P&gt;Note that if you data is not using a single byte character set then you need to use KINDEXC() function.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm" target="_self"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 20:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-FindC-function/m-p/486183#M126454</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-12T20:05:53Z</dc:date>
    </item>
  </channel>
</rss>

