<?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: How can I put a equation in my regression graph ? in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/How-can-I-put-a-equation-in-my-regression-graph/m-p/929293#M1875</link>
    <description>&lt;P&gt;First, use PROC GLM to get the parameter estimates for the regression model:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
set sashelp.cars;
x = EngineSize;
y = MPG_City;
run;

proc glm data=Have;
model y = x x*x / solution;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you have two choices:&lt;/P&gt;
&lt;P&gt;1. Display the regression coefficients in a table as name-value pairs&lt;/P&gt;
&lt;P&gt;2. Display the regression line as an equation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the first case (the table), here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Have noautolegend;
   reg Y=y X=x / degree=2;
   inset("Intercept"= "39.26"
         "x"   = "-8.65"
         "x^2" = "0.74") 
         / title="Regression Coefficients" opaque border;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the second case (an equation), here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Have noautolegend;
   reg Y=y X=x / degree=2;
   inset "y = 39.26 - 8.65*x + 0.74*x^2" / opaque border;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If necessary, there are also ways to get an inline superscipt instead of x^2.&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 18:27:54 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2024-05-22T18:27:54Z</dc:date>
    <item>
      <title>How can I put a equation in my regression graph ?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/How-can-I-put-a-equation-in-my-regression-graph/m-p/929257#M1873</link>
      <description>&lt;P&gt;Hi. I'm working with doses of limestone and styding soil pH. My model is a quadratic polynomial and I did a scatterplot in PROC SGPLOT. But I want to know if I can put the equation inside of the graph. How can I do that? I know how to do in Excell, but in the SAS on Demand I don't know if it's possible. Below is the code line that I used. Thanks for the helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=mydata noautolegend;&lt;BR /&gt;title height=11pt color=black "soil pH vs limestone";&lt;BR /&gt;scatter Y=pH X=DOSE;&lt;BR /&gt;yaxis label="pH";&lt;BR /&gt;xaxis min=0 max=1.92 values=(0 0.48 0.96 1.44 1.92) label="Limestone (t/ha)";&lt;BR /&gt;REG Y=pH X=DOSE/degree=2;&lt;BR /&gt;keylegend / location=inside position=top across=5 down=3 titleattrs=(wight=bold size=9pt) valueattrs=(collor=black size=7pt);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="josuerodrigues_0-1716391391985.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96668i4A17DFC3D5439B9D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="josuerodrigues_0-1716391391985.png" alt="josuerodrigues_0-1716391391985.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 15:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/How-can-I-put-a-equation-in-my-regression-graph/m-p/929257#M1873</guid>
      <dc:creator>josuerodrigues</dc:creator>
      <dc:date>2024-05-22T15:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I put a equation in my regression graph ?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/How-can-I-put-a-equation-in-my-regression-graph/m-p/929293#M1875</link>
      <description>&lt;P&gt;First, use PROC GLM to get the parameter estimates for the regression model:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
set sashelp.cars;
x = EngineSize;
y = MPG_City;
run;

proc glm data=Have;
model y = x x*x / solution;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you have two choices:&lt;/P&gt;
&lt;P&gt;1. Display the regression coefficients in a table as name-value pairs&lt;/P&gt;
&lt;P&gt;2. Display the regression line as an equation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the first case (the table), here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Have noautolegend;
   reg Y=y X=x / degree=2;
   inset("Intercept"= "39.26"
         "x"   = "-8.65"
         "x^2" = "0.74") 
         / title="Regression Coefficients" opaque border;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the second case (an equation), here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=Have noautolegend;
   reg Y=y X=x / degree=2;
   inset "y = 39.26 - 8.65*x + 0.74*x^2" / opaque border;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If necessary, there are also ways to get an inline superscipt instead of x^2.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 18:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/How-can-I-put-a-equation-in-my-regression-graph/m-p/929293#M1875</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-05-22T18:27:54Z</dc:date>
    </item>
  </channel>
</rss>

