<?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: Multiply and substract matrices as datasets in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722430#M5427</link>
    <description>Thank you very much. It worked like a charm.</description>
    <pubDate>Sun, 28 Feb 2021 16:33:20 GMT</pubDate>
    <dc:creator>Minh2710</dc:creator>
    <dc:date>2021-02-28T16:33:20Z</dc:date>
    <item>
      <title>Multiply and substract matrices as datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722375#M5423</link>
      <description>&lt;P&gt;Hello everyone. I wonder how I can multiply and substract matrices if they are presented as datasets in SAS. It would be great if anyone can show me an example of how I can do it with the two datasets below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data matrix_1;
	input a b c;
	cards;
	2 6 7
	1 8 3
	6 3 8
	;

data matrix_2;
	input a b c;
	cards;
	8 3 6
	1 7 9
	3 6 2
	;
run;

proc print data = matrix_1 noobs; run;
proc print data = matrix_2 noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 Feb 2021 00:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722375#M5423</guid>
      <dc:creator>Minh2710</dc:creator>
      <dc:date>2021-02-28T00:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply and substract matrices as datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722384#M5424</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Surely, there is a way to do it with data steps, but you can also do it with the IML procedure.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data matrix_1;
	input a b c;
	cards;
	2 6 7
	1 8 3
	6 3 8
	;

data matrix_2;
	input a b c;
	cards;
	8 3 6
	1 7 9
	3 6 2
	;
run;

proc iml;
	edit work.matrix_1;
	read all var _NUM_ into matrix_1[colname=numVars];;
	close work.matrix_1;	
	
	print matrix_1;

	edit work.matrix_2;
	read all var _NUM_ into matrix_2[colname=numVars];;
	close work.matrix_2;	
	
	print matrix_2;
	
	mult = matrix_1*matrix_2;
	
	print mult;
	
	subs = matrix_1 - matrix_2;
	
	print subs;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="results" style="width: 304px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55268iEEF26739CB908917/image-size/large?v=v2&amp;amp;px=999" role="button" title="Captura de pantalla 2021-02-27 212158.png" alt="results" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;results&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope that this can help you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Enrique&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 03:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722384#M5424</guid>
      <dc:creator>joseenrique1</dc:creator>
      <dc:date>2021-02-28T03:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply and substract matrices as datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722392#M5425</link>
      <description>&lt;P&gt;Moved the thread to the IML Forum.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 06:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722392#M5425</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-28T06:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply and substract matrices as datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722411#M5426</link>
      <description>&lt;P&gt;Enrique gave the correct answer, although I recommend that you use the USE statement to read the matrices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	use matrix_1;
	read all var _NUM_ into matrix_1;
	close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If needed, you can also &lt;A href="https://blogs.sas.com/content/iml/2016/02/08/read-data-into-vectors-or-matrix.html" target="_self"&gt;read individual variables into SAS/IML vectors&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 12:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722411#M5426</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-02-28T12:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multiply and substract matrices as datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722430#M5427</link>
      <description>Thank you very much. It worked like a charm.</description>
      <pubDate>Sun, 28 Feb 2021 16:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Multiply-and-substract-matrices-as-datasets/m-p/722430#M5427</guid>
      <dc:creator>Minh2710</dc:creator>
      <dc:date>2021-02-28T16:33:20Z</dc:date>
    </item>
  </channel>
</rss>

