<?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 the output return by the below in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481011#M124362</link>
    <description>&lt;P&gt;The documentation is j&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212242.htm" target="_self"&gt;ust one click away!&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Functions and CALL Routines: INDEX Function - 9.2&lt;!-- ***** HTMLHEAD ***** --&gt; &lt;!-- BEGIN htmlhead.inc --&gt; &lt;!-- Support Site Styles --&gt; &lt;!-- Global .js references --&gt; &lt;!-- YAHOO Global Object, DOM, Event, and Loader source file --&gt; &lt;!-- Enable Modal dialogs --&gt;&lt;!-- code for Website Opitimizer --&gt; &lt;!-- Start Visual Website Optimizer Asynchronous Code --&gt; &lt;!-- End Visual Website Optimizer Asynchronous Code --&gt; &lt;!-- END htmlhead.inc --&gt; &lt;!-- ***** GA INCLUDE ***** --&gt; &lt;!-- Start GA --&gt; &lt;!-- End GA --&gt; &lt;!-- CI360  --&gt; &lt;!-- End CI360  --&gt; &lt;!--Bookviewer Scripts--&gt; &lt;!--CDL provided CSS file:--&gt; &lt;!-- *** meta begin *** --&gt; &lt;!-- *** meta end *** --&gt; &lt;!--Begin Document level Meta Tags--&gt; &lt;!--Triplet Count: 1--&gt; &lt;!--End Document level Meta Tags--&gt;&lt;/P&gt;
&lt;DIV id="bookpage"&gt;
&lt;DIV class="sgml"&gt;
&lt;DL&gt;
&lt;DD&gt;
&lt;TABLE cellspacing="2" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR valign="top"&gt;
&lt;TD align="left" class="bgBlockLight"&gt;Both leading and trailing spaces are considered part of the &lt;SPAN class="strongEmph"&gt;excerpt&lt;/SPAN&gt; argument. To remove trailing spaces, include the TRIM function with the &lt;SPAN class="strongEmph"&gt;excerpt&lt;/SPAN&gt; variable inside the INDEX function.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The string&amp;nbsp; &lt;FONT face="courier new,courier"&gt;&amp;nbsp;'X=Y&amp;nbsp; &amp;nbsp; &amp;nbsp; '&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; is not found in variable A.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Jul 2018 04:52:41 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-07-25T04:52:41Z</dc:date>
    <item>
      <title>Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481008#M124359</link>
      <description>&lt;P&gt;Hi Pals,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a peice of code i am trying to understand Index function. according to me both are almost same code and should return the same result, but that is not the case. Could anybody help me understand the working of the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   length a b $14;
   a='ABC.DEF (X=Y)';
   b='X=Y';
   q=index(a,b);
   put q=;
run;

*proc contents data=test3 ;
*run;

data _null_;
   a = 'ABC.DEF (X=Y)';
   b = 'X=Y';
   x = index(a,b);
   put x=;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 04:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481008#M124359</guid>
      <dc:creator>shahsn11</dc:creator>
      <dc:date>2018-07-25T04:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481011#M124362</link>
      <description>&lt;P&gt;The documentation is j&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212242.htm" target="_self"&gt;ust one click away!&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Functions and CALL Routines: INDEX Function - 9.2&lt;!-- ***** HTMLHEAD ***** --&gt; &lt;!-- BEGIN htmlhead.inc --&gt; &lt;!-- Support Site Styles --&gt; &lt;!-- Global .js references --&gt; &lt;!-- YAHOO Global Object, DOM, Event, and Loader source file --&gt; &lt;!-- Enable Modal dialogs --&gt;&lt;!-- code for Website Opitimizer --&gt; &lt;!-- Start Visual Website Optimizer Asynchronous Code --&gt; &lt;!-- End Visual Website Optimizer Asynchronous Code --&gt; &lt;!-- END htmlhead.inc --&gt; &lt;!-- ***** GA INCLUDE ***** --&gt; &lt;!-- Start GA --&gt; &lt;!-- End GA --&gt; &lt;!-- CI360  --&gt; &lt;!-- End CI360  --&gt; &lt;!--Bookviewer Scripts--&gt; &lt;!--CDL provided CSS file:--&gt; &lt;!-- *** meta begin *** --&gt; &lt;!-- *** meta end *** --&gt; &lt;!--Begin Document level Meta Tags--&gt; &lt;!--Triplet Count: 1--&gt; &lt;!--End Document level Meta Tags--&gt;&lt;/P&gt;
&lt;DIV id="bookpage"&gt;
&lt;DIV class="sgml"&gt;
&lt;DL&gt;
&lt;DD&gt;
&lt;TABLE cellspacing="2" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR valign="top"&gt;
&lt;TD align="left" class="bgBlockLight"&gt;Both leading and trailing spaces are considered part of the &lt;SPAN class="strongEmph"&gt;excerpt&lt;/SPAN&gt; argument. To remove trailing spaces, include the TRIM function with the &lt;SPAN class="strongEmph"&gt;excerpt&lt;/SPAN&gt; variable inside the INDEX function.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The string&amp;nbsp; &lt;FONT face="courier new,courier"&gt;&amp;nbsp;'X=Y&amp;nbsp; &amp;nbsp; &amp;nbsp; '&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; is not found in variable A.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 04:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481011#M124362</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-25T04:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481023#M124368</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, If we see both the data step code I have written and value in variable a and b are same. The second one gives me correct answer but the first one does not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to understand this behavior why the second result is giving me correct answer and first one is not. If I comment the length code in first datastep I get the correct answer , but I am not able to understand the logic behind this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 06:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481023#M124368</guid>
      <dc:creator>shahsn11</dc:creator>
      <dc:date>2018-07-25T06:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481028#M124371</link>
      <description>The logic is in my answer. When you don't define a length there are no trailing spaces added to the value you assign.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jul 2018 06:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481028#M124371</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-07-25T06:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481029#M124372</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; already explained why the index function in the first step fails to find the string: the variable b is always 14 chars long and padded with blanks, not matter what value is assigned to it. If you don't use length (or attrib) to define a variable, its length is automatically set depending on the first use.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 06:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481029#M124372</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-07-25T06:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the output return by the below</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481034#M124377</link>
      <description>&lt;P&gt;Thanks Chris and Andrea for answering the question ...&amp;nbsp; It makes complete sense now ...appreciate the help in clearing the doubt.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 07:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-output-return-by-the-below/m-p/481034#M124377</guid>
      <dc:creator>shahsn11</dc:creator>
      <dc:date>2018-07-25T07:23:27Z</dc:date>
    </item>
  </channel>
</rss>

