<?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: Problem with a macro Array subscript out of range. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162563#M300031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The array elements are named F0-F33, but the array subscript still has to range from 1 to 34, not from 0 to 33.&amp;nbsp; It is illegal (array subscript out of range) to ask for FS[0] in your program.&amp;nbsp; If you would like the array subscript to range from 0 to 33, you have to define the array slightly differently:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array FS {0:33} FS0-FS33;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Jul 2014 17:39:13 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2014-07-01T17:39:13Z</dc:date>
    <item>
      <title>Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162560#M300028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anyone have any idea why I'm having an issue (Array subscript out of range error) with the following code? All the required variables are there. The syntax looks right. Any clues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO GENFLOWVAR; &lt;/P&gt;&lt;P&gt;DATA TMP_FA2; SET TMP_FA2;&lt;/P&gt;&lt;P&gt;ARRAY FLOWS FLOW0-FLOW33;&lt;/P&gt;&lt;P&gt;ARRAY FS F0-F33;&lt;/P&gt;&lt;P&gt;%DO I= 3 %TO 30;&amp;nbsp; &lt;/P&gt;&lt;P&gt;FLOWS[&amp;amp;I]=MEAN(FS[%EVAL(&amp;amp;I-3)],FS[%EVAL(&amp;amp;I-2)],FS[&amp;amp;I],FS[%EVAL(&amp;amp;I+1)],FS[%EVAL(&amp;amp;I+2)],FS[%EVAL(&amp;amp;I+3)]);&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%MEND;%GENFLOWVAR;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 17:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162560#M300028</guid>
      <dc:creator>kodmfl</dc:creator>
      <dc:date>2014-07-01T17:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162561#M300029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why are you using a macro do loop???? There is no need;&lt;/P&gt;&lt;P&gt;do i = 3 to 30;&lt;/P&gt;&lt;P&gt;FLOWS&lt;I&gt;=MEAN(FS[i-3],FS[I-2],FS&lt;I&gt;,FS[I+1],FS[I+2],FS[i+3];&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;should work just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add options mprint; before your macro call %genflowvar and examine the resulting generated code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 17:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162561#M300029</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-07-01T17:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162562#M300030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without your source data it's difficult to say, but note:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;This code will not generate FLOWS[0], FLOWS[1], or FLOWS[2].&lt;/LI&gt;&lt;LI&gt;Your data step is not terminated by a run statement.&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 17:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162562#M300030</guid>
      <dc:creator>JasonAllen</dc:creator>
      <dc:date>2014-07-01T17:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162563#M300031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The array elements are named F0-F33, but the array subscript still has to range from 1 to 34, not from 0 to 33.&amp;nbsp; It is illegal (array subscript out of range) to ask for FS[0] in your program.&amp;nbsp; If you would like the array subscript to range from 0 to 33, you have to define the array slightly differently:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array FS {0:33} FS0-FS33;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 17:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162563#M300031</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-07-01T17:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162564#M300032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 18:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162564#M300032</guid>
      <dc:creator>kodmfl</dc:creator>
      <dc:date>2014-07-01T18:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162565#M300033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 18:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162565#M300033</guid>
      <dc:creator>kodmfl</dc:creator>
      <dc:date>2014-07-01T18:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with a macro Array subscript out of range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162566#M300034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 18:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-a-macro-Array-subscript-out-of-range/m-p/162566#M300034</guid>
      <dc:creator>kodmfl</dc:creator>
      <dc:date>2014-07-01T18:21:46Z</dc:date>
    </item>
  </channel>
</rss>

