<?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: SAS/IML: ERROR: (execution) Matrix has not been set to a value. in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261157#M2654</link>
    <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for catching that.&amp;nbsp;There is still another error, however. I think the do-loop is not executing for some reason. When I print the 'profits' matrix it displays a matrix of all zeros. If you can assist me with this error, I would greatly appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dylan&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2016 17:54:02 GMT</pubDate>
    <dc:creator>NCSU_2016</dc:creator>
    <dc:date>2016-04-04T17:54:02Z</dc:date>
    <item>
      <title>SAS/IML: ERROR: (execution) Matrix has not been set to a value.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261115#M2652</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am receiving the following error: "&lt;SPAN&gt;ERROR: (execution) Matrix has not been set to a value." when using Proc IML. Any assistance that can be provided is much appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc iml;&lt;BR /&gt;use work.prof;&lt;BR /&gt;read all var {jun04 jul04 aug04 sep04 oct04 nov04 dec04 jan05 feb05 mar05 apr05 may05 jun05 jul05 aug05 sep05 oct05 nov05 dec05 jan06 feb06 mar06 apr06 may06 jun06 jul06 aug06 sep06 oct06 nov06 dec06 jan07 feb07 mar07 apr07 may07 jun07 jul07 aug07 sep07 oct07 nov07 dec07 jan08 feb08 mar08 apr08 may08 jun08 jul08 aug08 sep08 oct08 nov08 dec08 jan09 feb09 mar09 apr09 may09 jun09 jul09 aug09 sep09 oct09 nov09 dec09 jan10 feb10 mar10 apr10 may10 jun10 jul10 aug10 sep10 oct10 nov10 dec10 jan11 feb11 mar11 apr11 may11 jun11 jul11 aug11 sep11 oct11 nov11 dec11 jan12 feb12 mar12 apr12 may12 jun12 jul12 aug12 sep12 oct12 nov12 dec12 jan13 feb13 mar13 apr13 may13 jun13 jul13 aug13 sep13 oct13 nov13 dec13 jan14 feb14 mar14 apr14 may14 jun14 jul14 aug14 sep14 oct14 nov14 dec14 jan15 feb15 mar15 apr15 may15} into matrix;&lt;BR /&gt;n_months=ncol(matrix);&lt;BR /&gt;n_farms=nrow(matrix);&lt;BR /&gt;Profits = j(n_farms,n_months,0);&lt;BR /&gt;exit = j(n_farms,n_months,0);&lt;BR /&gt;real=(profits=0);&lt;BR /&gt;do i=1 to n_farms;&lt;BR /&gt;do j=4 to n_months;&lt;BR /&gt;profits[i,j]=matrix[i,j-1]+matrix[i,j-2]+matrix[i,j-3];&lt;BR /&gt;if profit[i,j]&amp;lt;0 then exit[i,j]=1;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;accuracy=(real=exit);&lt;BR /&gt;percent=mean(accuracy);&lt;BR /&gt;print percent;&lt;BR /&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the log:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;55&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;56 proc iml;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: IML Ready&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;57 use work.prof;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 read all var {jun04jul04&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! aug04sep04oct04nov04dec04jan05feb05mar05apr05may05jun05jul05aug05sep05oct05nov05dec05jan06feb06mar06a&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! pr06may06jun06jul06aug06sep06oct06nov06dec06jan07feb07mar07apr07may07jun07jul07aug07sep07oct07nov07de&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! c07jan08feb08mar08apr08may08jun08jul08aug08sep08oct08nov08dec08jan09feb09mar09apr09may09jun09jul09aug&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! 09sep09oct09nov09dec09jan10feb10mar10apr10may10jun10jul10aug10sep10oct10nov10dec10jan11feb11mar11apr1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! 1may11jun11jul11aug11sep11oct11nov11dec11jan12feb12mar12apr12may12jun12jul12aug12sep12oct12nov12dec12&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! jan13feb13mar13apr13may13jun13jul13aug13sep13oct13nov13dec13jan14feb14mar14apr14may14jun14jul14aug14&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58 ! sep14oct14nov14dec14jan15feb15mar15apr15may15} into matrix;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;59 n_months=ncol(matrix);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;60 n_farms=nrow(matrix);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61 Profits = j(n_farms,n_months,0);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 exit = j(n_farms,n_months,0);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 real=(profits=0);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 do i=1 to n_farms;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 !&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65 ! do j=4 to n_months;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 ! profits[i,j]=matrix[i,j-1]+matrix[i,j-2]+matrix[i,j-3];&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 ! if profit[i,j]&amp;lt;0 then exit[i,j]=1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 ! end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 end;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: (execution) Matrix has not been set to a value.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;operation : [ at line 67 column 11&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;operands : profit, i, j&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;profit 0 row 0 col (type ?, size 0)&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;i 1 row 1 col (numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;j 1 row 1 col (numeric)&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;4&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;statement : IF at line 67 column 2&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 accuracy=(real=exit);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 percent=mean(accuracy);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 print percent;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 quit;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Exiting IML.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE IML used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.22 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.23 seconds&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 16:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261115#M2652</guid>
      <dc:creator>NCSU_2016</dc:creator>
      <dc:date>2016-04-04T16:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/IML: ERROR: (execution) Matrix has not been set to a value.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261132#M2653</link>
      <description>&lt;P&gt;The error message says that a matrix is not define. If you look closer, you can find the message&lt;/P&gt;
&lt;DIV class="sasSource"&gt;&amp;gt;&amp;nbsp;&amp;nbsp; profit 0 row 0 col (type ?, size 0)&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;This tells you that 'profit' is not defined.&amp;nbsp; If you review the program, you will see that the similar-sounding variable 'profits' is defined, so I suspect you mistyped 'profits' as 'profit'.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;For information about how to find and fix errors in SAS/IML, see&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&lt;A href="http://blogs.sas.com/content/iml/2010/11/29/how-to-interpret-sasiml-error-messages.html" target="_self"&gt;How to interpret SAS/IML error messages&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;and&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&lt;A href="http://blogs.sas.com/content/iml/2010/12/13/how-to-find-and-fix-programming-errors.html" target="_self"&gt;How to find and fix programming errors&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Apr 2016 17:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261132#M2653</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-04-04T17:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/IML: ERROR: (execution) Matrix has not been set to a value.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261157#M2654</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for catching that.&amp;nbsp;There is still another error, however. I think the do-loop is not executing for some reason. When I print the 'profits' matrix it displays a matrix of all zeros. If you can assist me with this error, I would greatly appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dylan&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 17:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261157#M2654</guid>
      <dc:creator>NCSU_2016</dc:creator>
      <dc:date>2016-04-04T17:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/IML: ERROR: (execution) Matrix has not been set to a value.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261177#M2655</link>
      <description>&lt;P&gt;I don't see anything obviously wrong, so perhaps it is your data.&amp;nbsp; If I replace your USE and READ statements by&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;use sashelp.cars;
read all var _NUM_ into matrix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then the 'profits' matrix contains the values that&amp;nbsp;I would expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 18:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261177#M2655</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-04-04T18:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/IML: ERROR: (execution) Matrix has not been set to a value.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261271#M2656</link>
      <description>&lt;PRE&gt;
You'd better give us some data to test it.
Why not use Vector operation ?


do i=1 to n_farms;
do j=4 to n_months;
profits[i,j]=matrix[i,j-1]+matrix[i,j-2]+matrix[i,j-3];
if profit[i,j]&amp;lt;0 then exit[i,j]=1;
end;
end;

-&amp;gt;&amp;gt;

do j=4 to n_months;
profits[ ,j]=matrix[ ,j-1]+matrix[ ,j-2]+matrix[ ,j-3];
end;
exit=(profit&amp;lt;0);


&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Apr 2016 03:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/SAS-IML-ERROR-execution-Matrix-has-not-been-set-to-a-value/m-p/261271#M2656</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-05T03:27:34Z</dc:date>
    </item>
  </channel>
</rss>

