<?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: Can Proc SGPlot generate the slope value of a regression line? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118512#M4531</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all of your help and suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I already had all of my "proc sgplot" code written out, and since sgplot apparently does NOT have a way to generate the slope, I just did what I needed in a brute force manner as shown here:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each plot of interest, I used proc sgplot to get my plot with confidence intervals:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Scatter Plot with Confidence Interval - PMC Non-Hispanics, Dx = Normal";&lt;/P&gt;&lt;P&gt;proc sgplot data=allpmc3;&lt;/P&gt;&lt;P&gt;where short_dx = "Normal";&lt;/P&gt;&lt;P&gt;reg y=mmsetotal x=frstotal / cli ;&lt;/P&gt;&lt;P&gt;yaxis values= (0 to 30 by 5);&lt;/P&gt;&lt;P&gt;xaxis values = (0 to 55 by 5);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I did a Proc Rec using 'noprint', but with the OUTEST keyword to create a dataset containing the needed data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc reg data=allpmc3 noprint outest=PMC_norm;&lt;/P&gt;&lt;P&gt;where short_dx = "Normal";&lt;/P&gt;&lt;P&gt;model mmsetotal = frstotal;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I modified the dataset created by OUTEST so that it provided the info in the format I needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data PMC_norm2;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set PMC_norm;&lt;/P&gt;&lt;P&gt;rename frstotal = slope;&lt;/P&gt;&lt;P&gt;group = "PMC Normal";&lt;/P&gt;&lt;P&gt;keep group intercept frstotal;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, once I had repeated the above steps for multiple plots and groupings, I just put all my datasets together so that I could print a nice neat table of intercepts and slopes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data eq_params;&lt;/P&gt;&lt;P&gt;length group $12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set metab_ad2 metab_mci2 metab_norm2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pmc_ad2 pmc_mci2 pmc_norm2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=eq_params;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2013 18:41:59 GMT</pubDate>
    <dc:creator>dhappleby</dc:creator>
    <dc:date>2013-02-22T18:41:59Z</dc:date>
    <item>
      <title>Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118508#M4527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using proc sgplot with the reg option to generate a number of related plots.&amp;nbsp; Is there a way to get proc sgplot to generate the slope of the regression line for me, so that I can compare the slopes of different plots?&amp;nbsp; Or do I have to go run PROC REG? separately to have the system calculate the slope?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 15:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118508#M4527</guid>
      <dc:creator>dhappleby</dc:creator>
      <dc:date>2013-02-22T15:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118509#M4528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GPLOT will, but I'm not sure about sgplot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 16:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118509#M4528</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-02-22T16:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118510#M4529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's an example using gplot's "regeqn" option.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I'll have to let someone else answer whether sgplot has such an option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=foo;&lt;/P&gt;&lt;P&gt;by sex; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol1 value=dot interpol=rl;&lt;/P&gt;&lt;P&gt;proc gplot data=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;plot height*weight / regeqn;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="foo.png" class="jive-image-thumbnail jive-image" height="534" src="https://communities.sas.com/legacyfs/online/3120_foo.png" style="height: 534px; width: 710.9467455621302px;" width="711" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 16:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118510#M4529</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2013-02-22T16:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118511#M4530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since PROC REG calls SGRENDER in the background when you have ODS graphics on, I had hoped it would be easy to get the slope on the graph from PROC REG.&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp; with:&lt;/P&gt;&lt;PRE&gt;proc reg data=sashelp.class plots=FitPlot(stats=all);
&amp;nbsp; model height=weight;
&amp;nbsp; ods select FitPlot;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And while it gives lots of statistics, slope isn't one of them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="regplot.jpg" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/3122_regplot.jpg" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suppose you might be able to get it from reg if you mucked about with Stat.REG.Graphics.Fit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 18:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118511#M4530</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2013-02-22T18:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118512#M4531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all of your help and suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I already had all of my "proc sgplot" code written out, and since sgplot apparently does NOT have a way to generate the slope, I just did what I needed in a brute force manner as shown here:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each plot of interest, I used proc sgplot to get my plot with confidence intervals:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title "Scatter Plot with Confidence Interval - PMC Non-Hispanics, Dx = Normal";&lt;/P&gt;&lt;P&gt;proc sgplot data=allpmc3;&lt;/P&gt;&lt;P&gt;where short_dx = "Normal";&lt;/P&gt;&lt;P&gt;reg y=mmsetotal x=frstotal / cli ;&lt;/P&gt;&lt;P&gt;yaxis values= (0 to 30 by 5);&lt;/P&gt;&lt;P&gt;xaxis values = (0 to 55 by 5);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I did a Proc Rec using 'noprint', but with the OUTEST keyword to create a dataset containing the needed data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc reg data=allpmc3 noprint outest=PMC_norm;&lt;/P&gt;&lt;P&gt;where short_dx = "Normal";&lt;/P&gt;&lt;P&gt;model mmsetotal = frstotal;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I modified the dataset created by OUTEST so that it provided the info in the format I needed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data PMC_norm2;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;set PMC_norm;&lt;/P&gt;&lt;P&gt;rename frstotal = slope;&lt;/P&gt;&lt;P&gt;group = "PMC Normal";&lt;/P&gt;&lt;P&gt;keep group intercept frstotal;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, once I had repeated the above steps for multiple plots and groupings, I just put all my datasets together so that I could print a nice neat table of intercepts and slopes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data eq_params;&lt;/P&gt;&lt;P&gt;length group $12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set metab_ad2 metab_mci2 metab_norm2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pmc_ad2 pmc_mci2 pmc_norm2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=eq_params;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 18:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118512#M4531</guid>
      <dc:creator>dhappleby</dc:creator>
      <dc:date>2013-02-22T18:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can Proc SGPlot generate the slope value of a regression line?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118513#M4532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do the following:&lt;/P&gt;&lt;P&gt;(1) call PROC REG,&lt;/P&gt;&lt;P&gt;(2) create a macro variable with the parameter estimate (slope), and&lt;/P&gt;&lt;P&gt;(3) call PROC SGPLOT and use the INSET statement to put the slope on the graph. No need to modify any templates:&lt;/P&gt;&lt;P&gt;For an example, see &lt;A href="http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_templt_a0000000056.htm" title="http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_templt_a0000000056.htm"&gt;SAS/STAT(R) 9.3 User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 15:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-Proc-SGPlot-generate-the-slope-value-of-a-regression-line/m-p/118513#M4532</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-02-25T15:03:42Z</dc:date>
    </item>
  </channel>
</rss>

