Sample 40504: Add the regression equation to a regression plot generated with PROC SGPLOT
This sample uses the SAS/STAT REG procedure to calculate the regression equation being used and includes this information in the PROC SGPLOT output using a macro variable.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code below uses the SAS/STAT REG procedure to calculate the regression equation being used and includes this information in the PROC SGPLOT output using a macro variable.
proc reg data=sashelp.class outest=regdata noprint;
model weight=height / clm;
run;
quit;
/* Place the regression equation in a macro variable. */
data _null_;
set regdata;
call symput('eqn',"Weight="||Intercept||" + "||Height||"*Height");
run;
ods listing close;
ods html file='regressionplot.html' path='.' style=styles.statistical;
ods graphics / reset width=600px height=400px imagename='Regression' imagefmt=gif;
title 'PROC SGPLOT with Regression Equation';
proc sgplot data=sashelp.class;
reg x=height y=weight / clm;
/* The following INSET statement can be used as */
/* an alternative to the FOOTNOTE statement */
/* inset "&eqn" / position=bottomleft; */
footnote1 j=l "Regression Equation";
footnote2 j=l "&eqn";
run;
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses the SAS/STAT REG procedure to calculate the regression equation being used and includes this information in the PROC SGPLOT output using a macro variable.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
Date Modified: | 2010-10-22 10:11:45 |
Date Created: | 2010-08-03 13:38:25 |
Operating System and Release Information
SAS System | SAS/GRAPH | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
z/OS | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |