<?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: Matrix from dataset and calculations in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712635#M5388</link>
    <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2011/08/10/do-you-really-need-to-compute-that-matrix-inverse.html" target="_self"&gt;You probably don't need to compute the inverse matrix.&lt;/A&gt; It will be more efficient to use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   use x1;
      read all var {mktcap cash vol price} into X1;
   close x1;
   use x2;
      read all var {mktcap cash vol price} into X2;
   close x2; 
/*
   f = X1` * inv((X2` * X2)) * X1;
   print f;
*/
   A = X2` * X2;
  Z = solve(A, X1);
   f = X1` * Z;
   print f;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Jan 2021 11:52:26 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-01-20T11:52:26Z</dc:date>
    <item>
      <title>Matrix from dataset and calculations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712590#M5386</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need some help regarding matrices in SAS. I've got two datasets (large ones) from which I'd like to create matrices and do some calculations. The formula I'm trying to apply is x'(X'X)^-1x. X and x would be two matrices from two datasets.&lt;/P&gt;
&lt;P&gt;So far I've got the code below but it's incomplete and can't figure out the rest.&lt;/P&gt;
&lt;PRE&gt;proc iml;
use matrix;
read all var {mktcap cash vol price} into X;
Xtranspose = X`;
XtransX = X*X`;
print X Xtranspose XtransX;
&lt;/PRE&gt;
&lt;P&gt;Any help regarding how to calculate that will be very much appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 05:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712590#M5386</guid>
      <dc:creator>Antoine44</dc:creator>
      <dc:date>2021-01-20T05:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from dataset and calculations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712596#M5387</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273810"&gt;@Antoine44&lt;/a&gt;&amp;nbsp;See if you can use the code below as a template. Just created some small sample data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I moved this topic to the IML Forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x1;
input mktcap cash vol price;
datalines;
5 1 9 3
7 3 5 1
6 3 9 5
4 7 1 3
;

data x2;
input mktcap cash vol price;
datalines;
6 4 6 2
8 3 6 1
3 5 8 1
9 4 6 1
;


proc iml;
   use x1;
      read all var {mktcap cash vol price} into X1;
   close x1;

   use x2;
      read all var {mktcap cash vol price} into X2;
   close x2;

   f = X1` * inv((X2` * X2)) * X1;

   print f;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 07:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712596#M5387</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-20T07:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from dataset and calculations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712635#M5388</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2011/08/10/do-you-really-need-to-compute-that-matrix-inverse.html" target="_self"&gt;You probably don't need to compute the inverse matrix.&lt;/A&gt; It will be more efficient to use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   use x1;
      read all var {mktcap cash vol price} into X1;
   close x1;
   use x2;
      read all var {mktcap cash vol price} into X2;
   close x2; 
/*
   f = X1` * inv((X2` * X2)) * X1;
   print f;
*/
   A = X2` * X2;
  Z = solve(A, X1);
   f = X1` * Z;
   print f;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 11:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712635#M5388</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-01-20T11:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from dataset and calculations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712947#M5389</link>
      <description>That works too, thanks for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 21 Jan 2021 01:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712947#M5389</guid>
      <dc:creator>Antoine44</dc:creator>
      <dc:date>2021-01-21T01:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix from dataset and calculations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712948#M5390</link>
      <description>Great, thank you for your help!</description>
      <pubDate>Thu, 21 Jan 2021 01:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Matrix-from-dataset-and-calculations/m-p/712948#M5390</guid>
      <dc:creator>Antoine44</dc:creator>
      <dc:date>2021-01-21T01:04:21Z</dc:date>
    </item>
  </channel>
</rss>

