<?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: Plots within Proc IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752452#M5532</link>
    <description>&lt;P&gt;I would just use Proc SGPLOT with the REG statement to do the plot. But you would need to have the data in a dataset first.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 22:16:56 GMT</pubDate>
    <dc:creator>djrisks</dc:creator>
    <dc:date>2021-07-06T22:16:56Z</dc:date>
    <item>
      <title>Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752450#M5531</link>
      <description>&lt;P&gt;I know how to use plots within proc step but not sure how to add them within proc iml. In data step I can of course read the data step, in proc iml, I'm not sure how this is done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am just looking for a scatter plot with a regression line.&lt;/P&gt;
&lt;P&gt;This is what I have so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
A = {4 8,
     6 12};
b = {5, 1};
     

/* find p as orthogonal projection onto first column of A */
C = A[,1];
p = (C`*b)/norm(C)**2 * C;
print p;

/* use a generalized inverse to find ANY x such that 
   A*x = p */
x = ginv(A)*p;
print x;

/* Check that A*x = b */
z = A*x;
print z p;

yhat = A*x;
r = b-yhat;
print yhat r;

sse = ssq(r);
dfe = nrow(A)-ncol(A);
mse = sse/dfe;
print sse dfe mse;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 00:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752450#M5531</guid>
      <dc:creator>edasdfasdfasdfa</dc:creator>
      <dc:date>2021-07-07T00:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752452#M5532</link>
      <description>&lt;P&gt;I would just use Proc SGPLOT with the REG statement to do the plot. But you would need to have the data in a dataset first.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 22:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752452#M5532</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2021-07-06T22:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752469#M5533</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/201537"&gt;@edasdfasdfasdfa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;I know how to use plots within data step&lt;/STRONG&gt; but not sure how to add them within proc iml. &lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can you provide an example of how you create plots within a data step? That was something I didn't know was possible.....&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 23:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752469#M5533</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-06T23:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752471#M5534</link>
      <description>&lt;P&gt;sorry I meant to say proc step.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 00:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752471#M5534</guid>
      <dc:creator>edasdfasdfasdfa</dc:creator>
      <dc:date>2021-07-07T00:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752472#M5535</link>
      <description>&lt;P&gt;So is it not possible to do directly within proc iml without creating a data set?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 00:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752472#M5535</guid>
      <dc:creator>edasdfasdfasdfa</dc:creator>
      <dc:date>2021-07-07T00:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752527#M5536</link>
      <description>&lt;P&gt;Why not post it at IML forum and Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 12:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752527#M5536</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-07T12:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752529#M5537</link>
      <description>&lt;P&gt;Is there someone that can move it there? I wasn't sure if this was the better place or iml.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 12:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752529#M5537</guid>
      <dc:creator>edasdfasdfasdfa</dc:creator>
      <dc:date>2021-07-07T12:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752559#M5538</link>
      <description>&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_013/imlug/imlug_graphics_sect004.htm" target="_self"&gt;As stated in the documentation&lt;/A&gt;, the graphics in IML are not a complete interface to all the features that SGPLOT supports. So I think the best thing to do is to use the CREATE statement to write the data to a SAS data set and use PROC SGPLOT (either &lt;A href="https://blogs.sas.com/content/iml/2014/06/23/creating-ods-graphics-from-the-sasiml-language.html" target="_self"&gt;within a SUBMIT block&lt;/A&gt; or after you QUIT PROC IML.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, there are only two data points, so the scatter plot is rather sparse. But here it is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Observed values are in b.
   Predicted values are in yhat. 
   The explanatory variables are A[,1] and A[,2], 
   but A[,2]=2*A[,1], so this is equivalent to a 1-D problem */
xx = A[,1];
create PlotIt var {xx b yhat};
append;
close;

submit;
/* sort by X variable before using a SERIES statement */
proc sort data=PlotIt;
   by xx;
run;
proc sgplot data=PlotIt;
   label xx="Explanatory" b="Observed" yhat="Predicted";
   scatter x=xx y=b;
   series x=xx y=yhat;
run;
endsubmit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jul 2021 13:38:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752559#M5538</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-07T13:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752612#M5539</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;you are so knowledgeable!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw is the line created by the series statement equivalent to a regression line?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 16:48:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752612#M5539</guid>
      <dc:creator>edasdfasdfasdfa</dc:creator>
      <dc:date>2021-07-07T16:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752623#M5540</link>
      <description>&lt;P&gt;Yes. The least-squares regression line is the same as the predicted values.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 17:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/752623#M5540</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-07T17:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Plots within Proc IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/753140#M5543</link>
      <description>&lt;P&gt;If your question has been answered, please close this thread.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 13:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Plots-within-Proc-IML/m-p/753140#M5543</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-09T13:32:31Z</dc:date>
    </item>
  </channel>
</rss>

