<?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 Generating Slope for regression line in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Generating-Slope-for-regression-line/m-p/424463#M14645</link>
    <description>&lt;P&gt;So I used this link &lt;A href="https://blogs.sas.com/content/iml/2013/02/27/slope-of-a-regression-line.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2013/02/27/slope-of-a-regression-line.html&lt;/A&gt; and had a further quesiton about it.&lt;BR /&gt;&lt;BR /&gt;Is there a way to get the slope coefficient for each group separately?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used this code to generate the model and found a significant interaction effect. I wanted to generate some plots for these significant ones.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc mixed data=&amp;amp;data namelen = 200;&lt;BR /&gt; class &amp;amp;group;&lt;BR /&gt; model &amp;amp;response = &amp;amp;exposure &amp;amp;group &amp;amp;exposure*group + confounders;&lt;BR /&gt; ods output tests3 = Fulltest&amp;amp;i;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have this code to try and generate the graphs:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ods graphics off;&lt;BR /&gt;proc reg data=&amp;amp;data;&lt;BR /&gt; model &amp;amp;response = &amp;amp;alcoholvar;&lt;BR /&gt; ods output ParameterEstimates=PE;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; set PE;&lt;BR /&gt; if _n_ = 1 then call symput('Int', put(estimate, BEST6.)); &lt;BR /&gt; else call symput('Slope', put(estimate, BEST6.)); &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC sGPLOT DATA = &amp;amp;data (where =( &amp;amp;group ne .)) noautolegend dattrmap = attrmap ;&lt;BR /&gt;reg x = &amp;amp;x y = &amp;amp;y /group = &amp;amp;group clm clmtransparency = 0.4 attrid = &amp;amp;group;&lt;BR /&gt;title "&amp;amp;title";&lt;BR /&gt;inset "Intercept = &amp;amp;Int" "Slope = &amp;amp;Slope" /&lt;BR /&gt;border title="Parameter Estimates" position=topleft;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This only generates the intercept and slope for the first group listed. Is there any way to generate the slope for each group, (in my case there are 3 groups)? So there should be a slope for the line with group = 0, an 2nd slope for the line with group = 1, and a 3rd slope for the line with group = 2.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2018 21:54:44 GMT</pubDate>
    <dc:creator>Leon27607</dc:creator>
    <dc:date>2018-01-02T21:54:44Z</dc:date>
    <item>
      <title>Generating Slope for regression line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Generating-Slope-for-regression-line/m-p/424463#M14645</link>
      <description>&lt;P&gt;So I used this link &lt;A href="https://blogs.sas.com/content/iml/2013/02/27/slope-of-a-regression-line.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2013/02/27/slope-of-a-regression-line.html&lt;/A&gt; and had a further quesiton about it.&lt;BR /&gt;&lt;BR /&gt;Is there a way to get the slope coefficient for each group separately?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used this code to generate the model and found a significant interaction effect. I wanted to generate some plots for these significant ones.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc mixed data=&amp;amp;data namelen = 200;&lt;BR /&gt; class &amp;amp;group;&lt;BR /&gt; model &amp;amp;response = &amp;amp;exposure &amp;amp;group &amp;amp;exposure*group + confounders;&lt;BR /&gt; ods output tests3 = Fulltest&amp;amp;i;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I have this code to try and generate the graphs:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ods graphics off;&lt;BR /&gt;proc reg data=&amp;amp;data;&lt;BR /&gt; model &amp;amp;response = &amp;amp;alcoholvar;&lt;BR /&gt; ods output ParameterEstimates=PE;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; set PE;&lt;BR /&gt; if _n_ = 1 then call symput('Int', put(estimate, BEST6.)); &lt;BR /&gt; else call symput('Slope', put(estimate, BEST6.)); &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC sGPLOT DATA = &amp;amp;data (where =( &amp;amp;group ne .)) noautolegend dattrmap = attrmap ;&lt;BR /&gt;reg x = &amp;amp;x y = &amp;amp;y /group = &amp;amp;group clm clmtransparency = 0.4 attrid = &amp;amp;group;&lt;BR /&gt;title "&amp;amp;title";&lt;BR /&gt;inset "Intercept = &amp;amp;Int" "Slope = &amp;amp;Slope" /&lt;BR /&gt;border title="Parameter Estimates" position=topleft;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This only generates the intercept and slope for the first group listed. Is there any way to generate the slope for each group, (in my case there are 3 groups)? So there should be a slope for the line with group = 0, an 2nd slope for the line with group = 1, and a 3rd slope for the line with group = 2.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 21:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Generating-Slope-for-regression-line/m-p/424463#M14645</guid>
      <dc:creator>Leon27607</dc:creator>
      <dc:date>2018-01-02T21:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Slope for regression line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Generating-Slope-for-regression-line/m-p/424467#M14646</link>
      <description>&lt;P&gt;Proc reg may generate the plots you want, or at least give you an idea of what the data looks like. But I suspect that you need to tell Proc Reg which variable is your group variable with a BY statement. Sort the data by the group variable before Proc Reg and add a By statement.&lt;/P&gt;
&lt;P&gt;The parameter estimates will then have 3 values, one for each group and you will need to create 3 macro variables for intercept and slope to reference in the inset statement. Look at the values of the parameters data set.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 22:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Generating-Slope-for-regression-line/m-p/424467#M14646</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-02T22:09:37Z</dc:date>
    </item>
  </channel>
</rss>

