<?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 IML how to calculate new matrix based on values of two matrices in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646332#M5064</link>
    <description>&lt;P&gt;I am looking to generate a matrix that's based on two others (&lt;FONT&gt;letters are column names and numbers are row numbers to visualize&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;X = {u1 h1 a1, u2 h2 a2, u3 h3 a3}; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Y = {b1 f1 r1, b2 f2 r2};&lt;/P&gt;&lt;P&gt;what I am trying to come up with is this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z = {(b1-u1)+(f1-h1)+(r1-a1) (b2-u1)+(f2-h1)+(r2-a1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u2)+(f1-h2)+(r1-a2) (&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;b2-u2)+(f2-h2)+(r2-a2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u3)+(f1-h3)+(r1-a3) (&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;b2-u3)+(f2-h3)+(r2-a3)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u4)+(f1-h4)+(r1-a4) (b2-u4)+(f2-h4)+(r2-a4)}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;what's the most efficient way to go about this? I can only think of do-loops for each expression within parenthesis to create submatrices and then add them together? has any one done something similar. please point me in the right direction. many thanks in advance! &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 11 May 2020 16:01:30 GMT</pubDate>
    <dc:creator>ilya1</dc:creator>
    <dc:date>2020-05-11T16:01:30Z</dc:date>
    <item>
      <title>IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646332#M5064</link>
      <description>&lt;P&gt;I am looking to generate a matrix that's based on two others (&lt;FONT&gt;letters are column names and numbers are row numbers to visualize&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;X = {u1 h1 a1, u2 h2 a2, u3 h3 a3}; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Y = {b1 f1 r1, b2 f2 r2};&lt;/P&gt;&lt;P&gt;what I am trying to come up with is this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z = {(b1-u1)+(f1-h1)+(r1-a1) (b2-u1)+(f2-h1)+(r2-a1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u2)+(f1-h2)+(r1-a2) (&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;b2-u2)+(f2-h2)+(r2-a2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u3)+(f1-h3)+(r1-a3) (&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;b2-u3)+(f2-h3)+(r2-a3)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; , (b1-u4)+(f1-h4)+(r1-a4) (b2-u4)+(f2-h4)+(r2-a4)}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;SPAN style="background-color: #ffffff; box-sizing: border-box; color: #333333; cursor: text; display: inline; float: none; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;what's the most efficient way to go about this? I can only think of do-loops for each expression within parenthesis to create submatrices and then add them together? has any one done something similar. please point me in the right direction. many thanks in advance! &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 16:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646332#M5064</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-11T16:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646779#M5083</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;I am looking to generate a matrix that's based on two others (&lt;FONT&gt;letters are column names and&lt;BR /&gt;&amp;gt; numbers are row numbers to visualize&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT&gt;X = {u1 h1 a1, u2 h2 a2, u3 h3 a3}; &amp;nbsp;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Y = {b1 f1 r1, b2, f2, r2};&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand. Can you provide numbers for the "two other" matrices and what you expect for X and Y? I don't even know what "two other" matrices you are talking about. It looks like the matrices are u, h, a, b, f, and r.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without more information, the best I can suggest is vertical concatenation:&lt;/P&gt;
&lt;P&gt;X = u || h || a;&lt;/P&gt;
&lt;P&gt;Y = b || f || r;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 15:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646779#M5083</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-05-11T15:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646792#M5084</link>
      <description>&lt;P&gt;my apologies - I made a mistake with extra commas in the second matrix. I corrected the original post. here is what I am after in numbers&lt;/P&gt;&lt;P&gt;X = {2 7 4, 3 2 1, 5 9 3}&lt;/P&gt;&lt;P&gt;Y = {1 3 4, 2 5 1}&lt;/P&gt;&lt;P&gt;I am trying to have Z calculate like so:&lt;/P&gt;&lt;P&gt;Z = {(1-2)+(3-7)+(4-4) (2-2)+(5-7)+(4-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ,(1-3)+(3-2)+(4-1) (2-3)+(5-2)+(1-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ,(1-5)+(3-9)+(4-3) (2-5)+(5-9)+(1-3)}&amp;nbsp;&lt;/P&gt;&lt;P&gt;so result looks like this:&lt;/P&gt;&lt;P&gt;Z = {-5 1, 2 2, 9 -9}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks in advance for your thoughts!&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 16:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646792#M5084</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-11T16:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646808#M5085</link>
      <description>&lt;P&gt;I assume you made a mistake and the z[1,2] element should be -5 and the Z[3,1] element should be -9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you want to form the matrices&lt;/P&gt;
&lt;P&gt;M1 = Y[1, ] - X;&lt;/P&gt;
&lt;P&gt;M2 = Y[2,] - X;&lt;/P&gt;
&lt;P&gt;and then sum the rows of these matrices to form the columns of Z.&lt;/P&gt;
&lt;P&gt;For this example, you can use this one-liner, which uses the '+' &lt;A href="https://blogs.sas.com/content/iml/2011/06/06/use-subscript-reduction-operators.html" target="_self"&gt;subscript reduction operator&lt;/A&gt; to get the row sums:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
X = {2 7 4, 
     3 2 1, 
     5 9 3};
Y = {1 3 4, 
     2 5 1};

Z = ((Y[1,] - X)[ ,+]) || 
    ((Y[2,] - X)[ ,+]);
print Z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have an arbitrary number of rows in Y,&amp;nbsp;you can loop over the rows of Y like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;free Z;
do i = 1 to nrow(Y);
   Z = Z || (Y[i,] - X)[ ,+];
end;
print Z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It might also be possible to get this result by using matrix operators instead of a loop. Maybe by using a strategic application of the Kronecker product? If so,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9374"&gt;@IanWakeling&lt;/a&gt;&amp;nbsp;might have a suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 17:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646808#M5085</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-05-11T17:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646820#M5086</link>
      <description>&lt;P&gt;Thank you! This is almost there!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just can't figure out why calculation is always on the first element of X and Y&lt;/P&gt;&lt;P&gt;here is Z after calculating it both ways (loop or no loop, same result)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Z&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -9&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Z&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -9&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 11 May 2020 17:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646820#M5086</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-11T17:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646822#M5087</link>
      <description>&lt;P&gt;Because both rows of Y sum to 8. You can further simplify the computation to become&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rowSumX = X[ ,+];    /* sum of rows of X */
Z = Y[1 ,+] - rowSumX  ||
    Y[1 ,+] - rowSumX;
print Z;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 May 2020 17:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646822#M5087</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-05-11T17:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646855#M5088</link>
      <description>&lt;P&gt;this is great! Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 11 May 2020 19:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646855#M5088</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-11T19:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646990#M5089</link>
      <description>&lt;P&gt;You could apply the Kroneker product (the @ operator) and avoid the loop as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;diff = Y @ j(nrow(X), 1) - j(nrow(Y), 1) @ X;
Z = shapecol( diff[ ,+], nrow(X));
print Z;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is not as easy to see what is going on, so you may prefer Rick's solution if others need to use your code.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 07:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/646990#M5089</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-05-12T07:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647160#M5102</link>
      <description>&lt;P&gt;Thank you! I need to study up this approach - not easy to see.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just curious - how to make this work on multiplication?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a = {1 2 3}&lt;/P&gt;&lt;P&gt;b={1 2 3, 4 5 6, 7 8 9}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to get to:&lt;/P&gt;&lt;P&gt;c={1 4 9, 4 10 18, 7 16 27}&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 17:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647160#M5102</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-12T17:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647167#M5103</link>
      <description>&lt;P&gt;never mind - this is just element wise multiplication. I am thinking too much I suppose. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 17:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647167#M5103</guid>
      <dc:creator>ilya1</dc:creator>
      <dc:date>2020-05-12T17:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: IML how to calculate new matrix based on values of two matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647336#M5105</link>
      <description>&lt;P&gt;Indeed it is elementwise multiplication, but if you want the row sums of c, which was part of the original problem, then the whole process simplifies to normal matrix multiplication:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a = {1 2 3};
b = {1 2 3, 4 5 6, 7 8 9};
d = b * a`;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 May 2020 07:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/IML-how-to-calculate-new-matrix-based-on-values-of-two-matrices/m-p/647336#M5105</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-05-13T07:15:09Z</dc:date>
    </item>
  </channel>
</rss>

