Sample 24933: Display the RSQUARE value at the bottom of PROC GPLOT output
This sample code first uses PROC REG to calculate the RSQUARE value for the variables used by PROC GPLOT when a linear regression interpolation is specified on a SYMBOL statement. A macro variable is then created using the RSQUARE value. This macro variable is then used on a FOOTNOTE statement to display the RSQUARE value at the bottom of the GPLOT output.
See SAS Note 40504 for a sample that shows how to create this graph using PROC SGPLOT.
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 code first uses PROC REG to calculate the RSQUARE value for the variables used by PROC GPLOT when a linear regression interpolation is specified on a SYMBOL statement. A macro variable is then created using the RSQUARE value. This macro variable is then used on a FOOTNOTE statement to display the RSQUARE value at the bottom of the GPLOT output.
The graphics output in the Results tab was produced using SASĀ® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=9pt;
/* Create a sample data set */
data one;
do i=1 to 10;
XVAR=ranuni(0);
YVAR=ranuni(0);
output;
end;
run;
/* Use PROC REG to create output data set TWO */
proc reg data=one outest=two;
model yvar=xvar / selection=rsquare;
run;
quit;
/* Create a macro variable called RSQ which */
/* resolves to the rsquare value. */
data _null_;
set two;
call symput('rsq',_RSQ_);
run;
/* Use the macro variable RSQ in a FOOTNOTE statement */
footnote1 ' ';
footnote2 j=L " RSQUARE=&rsq";
footnote3 ' ';
symbol1 v=none i=rl c=vibg;
axis1 minor=none;
title1 'Display the RSQUARE value at the bottom of the graph';
proc gplot data=one;
plot yvar*xvar / regeqn vaxis=axis1 haxis=axis1;
run;
quit;
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 REG procedure to calculate the RSQUARE value for the variable values used in the GPLOT procedure when a linear regression interpolation is specified on a SYMBOL statement.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT
|
Date Modified: | 2005-08-31 03:03:20 |
Date Created: | 2004-11-11 11:08:03 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | n/a |