<?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 SAS INDEX function not working properly. Can anyone tell why it is so? in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113393#M9284</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I am running following code on Mainframe system and INDEX function is giving unexpected results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DATA DATA01;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FILE OUTFIL ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;V = TRIM(LEFT(SCAN('&amp;nbsp; 05 WAAA-ZZ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(4) COMP.',2, ' ' ))) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;I = INDEX(' MOVE WAAA-ZZ(1) TO WBBB-RESP-ZZ ', V ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PUT V ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PUT I ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;RUN ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;On output file it is showing&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;WAAA-ZZ&amp;nbsp;&amp;nbsp; (i.e. value stored in V)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;0&amp;nbsp;&amp;nbsp;&amp;nbsp; (i.e. value of I - which mean it has not found WAAA-ZZ in the given string, however we can see that it is present there)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Can anyone explain why it is behaving in this way?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Apr 2013 12:29:18 GMT</pubDate>
    <dc:creator>GRV</dc:creator>
    <dc:date>2013-04-19T12:29:18Z</dc:date>
    <item>
      <title>SAS INDEX function not working properly. Can anyone tell why it is so?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113393#M9284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I am running following code on Mainframe system and INDEX function is giving unexpected results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DATA DATA01;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FILE OUTFIL ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;V = TRIM(LEFT(SCAN('&amp;nbsp; 05 WAAA-ZZ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(4) COMP.',2, ' ' ))) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;I = INDEX(' MOVE WAAA-ZZ(1) TO WBBB-RESP-ZZ ', V ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PUT V ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PUT I ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;RUN ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;On output file it is showing&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;WAAA-ZZ&amp;nbsp;&amp;nbsp; (i.e. value stored in V)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;0&amp;nbsp;&amp;nbsp;&amp;nbsp; (i.e. value of I - which mean it has not found WAAA-ZZ in the given string, however we can see that it is present there)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Can anyone explain why it is behaving in this way?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 12:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113393#M9284</guid>
      <dc:creator>GRV</dc:creator>
      <dc:date>2013-04-19T12:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS INDEX function not working properly. Can anyone tell why it is so?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113394#M9285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are placing the TRIM() function in the wrong place.&amp;nbsp; SAS stores character variables as fixed length strings padded with spaces.&amp;nbsp; So in the assignment statement SAS will just put the trailing spaces back onto the value of V to pad it out to fill the fixed length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;V = SCAN('&amp;nbsp; 05 WAAA-ZZ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(4) COMP.',2, ' ' ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;I = INDEX(' MOVE WAAA-ZZ(1) TO WBBB-RESP-ZZ ',&amp;nbsp; Trim(V) ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;I = INDEX(' MOVE WAAA-ZZ(1) TO WBBB-RESP-ZZ '&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;SCAN('&amp;nbsp; 05 WAAA-ZZ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(4) COMP.',2, ' ' )&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Apr 2013 13:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113394#M9285</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-19T13:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS INDEX function not working properly. Can anyone tell why it is so?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113395#M9286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help Tom. It worked correctly when I placed the TRIM function in correct statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 08:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/SAS-INDEX-function-not-working-properly-Can-anyone-tell-why-it/m-p/113395#M9286</guid>
      <dc:creator>GRV</dc:creator>
      <dc:date>2013-04-24T08:34:35Z</dc:date>
    </item>
  </channel>
</rss>

