<?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 Error: (execution) Invalid subscript or subscript out of range in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300536#M3025</link>
    <description>&lt;P&gt;I receive the error: &lt;STRONG&gt;"(execution) Invalid subscript or subscript out of range&lt;/STRONG&gt;" when&amp;nbsp;try to create a submatrix &lt;EM&gt;tmp&lt;/EM&gt; which is based on matrix &lt;EM&gt;FD&lt;/EM&gt; which contains all variables and observations from the&amp;nbsp;dataset &lt;EM&gt;WFD&lt;/EM&gt; (which contains 62 columns/variables and 2108 rows).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In &lt;EM&gt;tmp&lt;/EM&gt;, I want to sum row 1 to 34, and row 35 to 69, and so on, until it reaches row 2074 to 2108 from the &lt;EM&gt;FD&lt;/EM&gt; matrix, so that finally, the tmp matrix becomas a 62x62 matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do anyone see what I am doing wrong in my code?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I have tried to find the mistake by looking in the log, i.e. by trying to find this reference point: &lt;EM&gt;&lt;FONT color="#0000ff"&gt;operation: [ at line 2965 column 194&lt;FONT color="#000000"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#000000"&gt;but I really don't understand where in the log&amp;nbsp;I can find this lines and columns with really high numbers. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help is very appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tmpf ; set WFD;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use tmpf(drop = year);&lt;BR /&gt;read all var _all_ into FD;&lt;BR /&gt;k = 0;&lt;BR /&gt;do i = 1 to 2108 by 34;&lt;BR /&gt;&amp;nbsp; j = i+33;&lt;BR /&gt;&amp;nbsp; k = k+1;&lt;BR /&gt;rows = i:j;&lt;BR /&gt;cols = k:k;&lt;BR /&gt;tmp = fd[rows,cols];&lt;BR /&gt;DMD =&amp;nbsp; DMD // tmp ;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The log:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 14756 observations read from the data set WEBWORK.WFD.&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WEBWORK.TMPF has 2108 observations and 63 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.13 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: IML Ready&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#ff0000"&gt;ERROR: (execution) Invalid subscript or subscript out of range.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000ff"&gt;operation : [ at line 2650 column 193&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;operands : fd, rows, cols&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;FD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2108 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;rows&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34 cols&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;cols&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Best regards,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Birgitte&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Sep 2016 10:12:52 GMT</pubDate>
    <dc:creator>biringstad</dc:creator>
    <dc:date>2016-09-24T10:12:52Z</dc:date>
    <item>
      <title>Error: (execution) Invalid subscript or subscript out of range</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300536#M3025</link>
      <description>&lt;P&gt;I receive the error: &lt;STRONG&gt;"(execution) Invalid subscript or subscript out of range&lt;/STRONG&gt;" when&amp;nbsp;try to create a submatrix &lt;EM&gt;tmp&lt;/EM&gt; which is based on matrix &lt;EM&gt;FD&lt;/EM&gt; which contains all variables and observations from the&amp;nbsp;dataset &lt;EM&gt;WFD&lt;/EM&gt; (which contains 62 columns/variables and 2108 rows).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In &lt;EM&gt;tmp&lt;/EM&gt;, I want to sum row 1 to 34, and row 35 to 69, and so on, until it reaches row 2074 to 2108 from the &lt;EM&gt;FD&lt;/EM&gt; matrix, so that finally, the tmp matrix becomas a 62x62 matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do anyone see what I am doing wrong in my code?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I have tried to find the mistake by looking in the log, i.e. by trying to find this reference point: &lt;EM&gt;&lt;FONT color="#0000ff"&gt;operation: [ at line 2965 column 194&lt;FONT color="#000000"&gt;, &lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#000000"&gt;but I really don't understand where in the log&amp;nbsp;I can find this lines and columns with really high numbers. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help is very appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tmpf ; set WFD;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use tmpf(drop = year);&lt;BR /&gt;read all var _all_ into FD;&lt;BR /&gt;k = 0;&lt;BR /&gt;do i = 1 to 2108 by 34;&lt;BR /&gt;&amp;nbsp; j = i+33;&lt;BR /&gt;&amp;nbsp; k = k+1;&lt;BR /&gt;rows = i:j;&lt;BR /&gt;cols = k:k;&lt;BR /&gt;tmp = fd[rows,cols];&lt;BR /&gt;DMD =&amp;nbsp; DMD // tmp ;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The log:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 14756 observations read from the data set WEBWORK.WFD.&lt;/P&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WEBWORK.TMPF has 2108 observations and 63 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.13 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.05 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: IML Ready&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&lt;FONT color="#ff0000"&gt;ERROR: (execution) Invalid subscript or subscript out of range.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;FONT color="#0000ff"&gt;operation : [ at line 2650 column 193&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;operands : fd, rows, cols&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;FD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2108 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;rows&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34 cols&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;cols&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Best regards,&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Birgitte&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 10:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300536#M3025</guid>
      <dc:creator>biringstad</dc:creator>
      <dc:date>2016-09-24T10:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error: (execution) Invalid subscript or subscript out of range</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300582#M3026</link>
      <description>&lt;PRE&gt;
Your code doesn't look right.


data tmpf ; 
retain year 1;
array x{*} var1-var62;
do i=1 to 2108;
 do j=1 to dim(x);
  x{j}=ranuni(0);
 end;
 output;
end;
drop i j;
run;
 
proc iml;
i=0;
DMD=j(62,62,.);

use tmpf(drop = year);
do data;
 read next 34 var _all_ into tmp;
 i=i+1;
 DMD[i,]=tmp[+,];
end;
close;

create want from dmd;
append from dmd;
close;
quit;

&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Sep 2016 02:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300582#M3026</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-25T02:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error: (execution) Invalid subscript or subscript out of range</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300705#M3027</link>
      <description>&lt;P&gt;I think the&amp;nbsp;problem is the number of columns in FD.&amp;nbsp; The log says it has 60 columns, however the loop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do i = 1 to 2108 by 34;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will iterate 62 times.&amp;nbsp; So the error is occuring on the 61st iteration when you try to access the 61st column.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 07:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300705#M3027</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2016-09-26T07:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error: (execution) Invalid subscript or subscript out of range</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300826#M3028</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, I think that was the problem. I discovered that I made a mistake initially when I made the dataset (WFD) that I use to create the FD matrix, and therefore I had a smaller column range than planned. When I changed it to the correct one the code above worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Birgitte&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 17:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-execution-Invalid-subscript-or-subscript-out-of-range/m-p/300826#M3028</guid>
      <dc:creator>biringstad</dc:creator>
      <dc:date>2016-09-26T17:44:35Z</dc:date>
    </item>
  </channel>
</rss>

