<?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: What is the max number index for i in the loop below? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754463#M237929</link>
    <description>&lt;P&gt;try this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=lst;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=i;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in %do loops.&lt;/P&gt;
&lt;P&gt;you can get value in macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if $i = index then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is this typo?&lt;/P&gt;
&lt;P&gt;it may be "&amp;amp;i".&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 23:23:05 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-07-15T23:23:05Z</dc:date>
    <item>
      <title>What is the max number index for i in the loop below?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754459#M237926</link>
      <description>&lt;P&gt;I have this code and I want to see how to loop works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proq sql;
select max(index) into :lst
from my tables;

%macro thisSample;
options spools;
%do i = 1 %to &amp;amp;lst.;
data _null_:
set frommypreviousread;
if $i = index then do;
&lt;/PRE&gt;
&lt;P&gt;what is the first value in the loop for &amp;amp;i = index;&lt;/P&gt;
&lt;P&gt;if index is max(index)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 23:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754459#M237926</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-15T23:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: What is the max number index for i in the loop below?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754463#M237929</link>
      <description>&lt;P&gt;try this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=lst;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=i;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in %do loops.&lt;/P&gt;
&lt;P&gt;you can get value in macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if $i = index then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is this typo?&lt;/P&gt;
&lt;P&gt;it may be "&amp;amp;i".&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 23:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754463#M237929</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-07-15T23:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: What is the max number index for i in the loop below?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754468#M237931</link>
      <description>&lt;P&gt;The first value for &amp;amp;i will be one.&lt;BR /&gt;It can be verified by making changes as follows. This will put the value oi i in every iteration.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do i = 1 %to &amp;amp;lst.;
%put &amp;amp;=i;
data _null_:&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 00:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-max-number-index-for-i-in-the-loop-below/m-p/754468#M237931</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-07-16T00:18:11Z</dc:date>
    </item>
  </channel>
</rss>

