<?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: Does variable length affect the outcome of INDEX function? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646733#M193497</link>
    <description>&lt;P&gt;Most of the functions such as LOWCASE when used as a parameter to another function return the result&amp;nbsp; padded with blanks to length of the variable.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;x2 = index(lowcase(security_name), strip( lowcase(name_holding_clean) ) );&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 May 2020 14:51:20 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-11T14:51:20Z</dc:date>
    <item>
      <title>Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646731#M193496</link>
      <description>&lt;P&gt;My code returns unexpected result as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x = index(lowcase(security_name), lowcase("alltel communications"));
x2 = index(lowcase(security_name), lowcase(name_holding_clean));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xyxu_0-1589208329247.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39292iB79F1AEAAE6D29DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xyxu_0-1589208329247.png" alt="xyxu_0-1589208329247.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Shouldn't x=x2? My guess is that it's related to the length of name_holding_clean, but not sure how to deal with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 14:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646731#M193496</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2020-05-11T14:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646733#M193497</link>
      <description>&lt;P&gt;Most of the functions such as LOWCASE when used as a parameter to another function return the result&amp;nbsp; padded with blanks to length of the variable.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;x2 = index(lowcase(security_name), strip( lowcase(name_holding_clean) ) );&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 14:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646733#M193497</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-11T14:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646735#M193498</link>
      <description>&lt;P&gt;See Maxim 46.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 14:54:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646735#M193498</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-11T14:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646749#M193505</link>
      <description>&lt;P&gt;You are right, thanks!&lt;/P&gt;&lt;P&gt;Why LOWCASE does not pad&amp;nbsp;with blanks when the I copy the string, instead of using a variable as input?&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 15:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646749#M193505</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2020-05-11T15:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646755#M193507</link>
      <description>&lt;P&gt;It takes the length of the source you supply. With a literal, it is the length of the string as written, with a variable, the&amp;nbsp;&lt;EM&gt;defined&lt;/EM&gt; length of the variable.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 15:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646755#M193507</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-11T15:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Does variable length affect the outcome of INDEX function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646769#M193510</link>
      <description>&lt;P&gt;Note that the LOWCASE() function calls has nothing to do with this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS stores character variables as fixed length.&amp;nbsp; &amp;nbsp;If you assign a value that is shorter than the max then it is padded with spaces. If you assign a value that is longer it is truncated.&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 15:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-variable-length-affect-the-outcome-of-INDEX-function/m-p/646769#M193510</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-05-11T15:31:21Z</dc:date>
    </item>
  </channel>
</rss>

