<?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: index value in array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368310#M87828</link>
    <description>&lt;P&gt;These are just "line numbers" similar to those used in eg BASIC, to identify places in the code.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/64404"&gt;@SAS_inquisitive&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;What are numeric values 7 and 2?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2017 13:24:50 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-06-19T13:24:50Z</dc:date>
    <item>
      <title>index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368259#M87805</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Why is the value of index (i) 2 in below two programs since the loop iterates just only for once?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input x y;
	cards;
1 2
;

data want;
	set have;
	array ar{*} x y;

	do i = 1 to dim(ar)-1;
		put i =;
		var = ar{i+1}-ar{i};
	end;

	put i =;
run;

data have;
	input x y;
	cards;
1 2
;

data want;
	set have;
	array ar{*} x y;

	do i = 1 to dim(ar)-1;
		put i =;
		var = ar{i}-ar{i};
	end;

	put i =;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 12:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368259#M87805</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-06-19T12:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368269#M87810</link>
      <description>&lt;P&gt;When i increases to be &amp;gt; dim(ar)-1, the statements inside the loop are not executed. So i increases to be equal to 2, but i is never equal to two inside the loop. Run this program to verify&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input x y;
	cards;
1 2
;

data want;
	set have;
	array ar{*} x y;

	do i = 1 to (dim(ar)-1);
		put i=;
		var = ar{i+1}-ar{i};
	end;
	
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Jun 2017 12:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368269#M87810</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-19T12:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368270#M87811</link>
      <description>&lt;P&gt;A do loop works like that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 - set index variable to initial value&lt;/P&gt;
&lt;P&gt;2 - compare index variable with termination value&lt;/P&gt;
&lt;P&gt;3 - if higher goto 7&lt;/P&gt;
&lt;P&gt;4 - execute loop body&lt;/P&gt;
&lt;P&gt;5 - increment index value&lt;/P&gt;
&lt;P&gt;6 - goto 2&lt;/P&gt;
&lt;P&gt;7 - end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you see that the loop terminates only when the index variable exceeds the termination value.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 12:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368270#M87811</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-19T12:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368276#M87815</link>
      <description>&lt;P&gt;The index of a do loop, by definition, increases until it exceeds it's "to" value. When it does exceed that value, it exits from the loop with processing the commands within the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 12:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368276#M87815</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-19T12:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368301#M87826</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;What are numeric values 7 and 2?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 13:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368301#M87826</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-06-19T13:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368310#M87828</link>
      <description>&lt;P&gt;These are just "line numbers" similar to those used in eg BASIC, to identify places in the code.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/64404"&gt;@SAS_inquisitive&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;What are numeric values 7 and 2?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 13:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368310#M87828</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-19T13:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: index value in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368321#M87830</link>
      <description>Thank you all for the explanation.</description>
      <pubDate>Mon, 19 Jun 2017 13:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/index-value-in-array/m-p/368321#M87830</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-06-19T13:35:22Z</dc:date>
    </item>
  </channel>
</rss>

