<?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: ERROR: (execution) Matrices do not conform to the operation. in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660353#M5160</link>
    <description>&lt;P&gt;Yes it is. I have changed it to sqrt().&amp;nbsp;&lt;/P&gt;&lt;P&gt;But why it returns following error when I perform sqrt() for this calculation.&lt;/P&gt;&lt;P class="p1"&gt;ERROR: (execution) Invalid argument to function.&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;count &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;: number of occurrences is 1437&lt;/P&gt;&lt;P class="p3"&gt;operation : SQRT at line 93 column 13&lt;/P&gt;&lt;P class="p3"&gt;operands&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;: sigma_2&lt;/P&gt;&lt;P class="p3"&gt;sigma_2 &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;2531 rows&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;1 col &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(numeric)&lt;/P&gt;&lt;P class="p3"&gt;If I remove the sqrt() function, it works well.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2020 01:49:15 GMT</pubDate>
    <dc:creator>Sasulee</dc:creator>
    <dc:date>2020-06-17T01:49:15Z</dc:date>
    <item>
      <title>ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/659893#M5156</link>
      <description>&lt;P&gt;When I run the code following&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
start main;
varNames = {"tau" "K" "call_option_price" "S" "r" "put_option_price" "T" };
use cboe; * use the import data set;
read all var varNames;&lt;BR /&gt;T = tau/365;
F = K + exp(r*T) * (call_option_price - put_option_price);
K0 = int(F);
finish;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P class="p5"&gt;It returns&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;ERROR: (execution) Matrices do not conform to the operation.&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;where&lt;/P&gt;&lt;P class="p1"&gt;operation : * at line 89 column 14&lt;/P&gt;&lt;P class="p1"&gt;operands&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;: r, T&lt;/P&gt;&lt;P class="p1"&gt;r &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;2531 rows&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;1 col &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(numeric)&lt;/P&gt;&lt;P class="p1"&gt;T &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;2531 rows&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;1 col &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(numeric)&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I know the calculations should be conducted between matched matrixes. However, I found the variable r and T have the same structure with 2531 rows and 1 col.&amp;nbsp;&lt;/P&gt;&lt;P class="p5"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p5"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 09:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/659893#M5156</guid>
      <dc:creator>Sasulee</dc:creator>
      <dc:date>2020-06-16T09:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/659952#M5157</link>
      <description>&lt;P&gt;You have read in column vectors. There are &lt;A href="https://blogs.sas.com/content/iml/2013/05/20/matri-multiplication.html" target="_self"&gt;two ways to multiply with column vectors&lt;/A&gt;: the inner product and elementwise multiplication. An inner product will return a scalar. Elementwise multiplication will return a vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The asterisk (*) is used for matrix and vector operations. So &lt;FONT face="courier new,courier"&gt;r`*T&lt;/FONT&gt;&amp;nbsp;will return the inner product. The # operator performs elementwise multiplication. So &lt;FONT face="courier new,courier"&gt;r#T&lt;/FONT&gt;&amp;nbsp;will return a vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to perform the same operation on each row of the data, then the syntax is&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;F = K + exp(r#T) # (call_option_price - put_option_price);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you can delete the lines "start main;" and "finish." You might have inserted them because you have a RUN statement at the end of the program. &lt;A href="https://blogs.sas.com/content/iml/2010/09/13/never-end-proc-iml-with-a-run-statement.html" target="_self"&gt;A RUN statement is not necessary.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 09:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/659952#M5157</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-06-16T09:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660216#M5158</link>
      <description>&lt;P&gt;It works. However, when I use this method to run the following syntax, it returns&amp;nbsp;ERROR: Invocation of unresolved module SQR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sigma = sqr(2/T # sum(deltak/K) # exp(R # T) # Q-1/T # (F/K0-1) ## 2);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;where deltak is an Integer 5 and all the other variables are read in iml as&amp;nbsp;&lt;SPAN&gt;elementwise I think. Is it caused by the incorrect use of sum function? The parameter k is a vector with n rows and 1 column. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;how can I achieve&amp;nbsp;Summation[i] (deltak[i]/k[i]) correctly?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 22:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660216#M5158</guid>
      <dc:creator>Sasulee</dc:creator>
      <dc:date>2020-06-16T22:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660217#M5159</link>
      <description>&lt;P&gt;The ERROR message tells you the problem: There is no SQR function. Did you mean SQRT for "square root"?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SUM function looks correct.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 23:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660217#M5159</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-06-16T23:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660353#M5160</link>
      <description>&lt;P&gt;Yes it is. I have changed it to sqrt().&amp;nbsp;&lt;/P&gt;&lt;P&gt;But why it returns following error when I perform sqrt() for this calculation.&lt;/P&gt;&lt;P class="p1"&gt;ERROR: (execution) Invalid argument to function.&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;count &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;: number of occurrences is 1437&lt;/P&gt;&lt;P class="p3"&gt;operation : SQRT at line 93 column 13&lt;/P&gt;&lt;P class="p3"&gt;operands&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;: sigma_2&lt;/P&gt;&lt;P class="p3"&gt;sigma_2 &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;2531 rows&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;1 col &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(numeric)&lt;/P&gt;&lt;P class="p3"&gt;If I remove the sqrt() function, it works well.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 01:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/660353#M5160</guid>
      <dc:creator>Sasulee</dc:creator>
      <dc:date>2020-06-17T01:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: (execution) Matrices do not conform to the operation.</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/661052#M5161</link>
      <description>&lt;P&gt;This error message arises when you try to take the square root of negative numbers, and it clear that this has happened 1437 times.&amp;nbsp; To see where the problem is occuring, I suggest you split the one line of code into 3 or 4 separate lines and print the values at each step for a small data set. The problem may be the data itself, or it may be that your large compound expression is not evaluated in the way that you expect because of operator precedence, so try adding more parentheses to make the evaluation order unambiguous.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 07:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-execution-Matrices-do-not-conform-to-the-operation/m-p/661052#M5161</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-06-17T07:24:40Z</dc:date>
    </item>
  </channel>
</rss>

