Sample 24933: Display the RSQUARE value
/******************************************************************************/
/* This sample code will use 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. */
/* This example represents the rsquare value on the GPLOT by creating */
/* a macro variable that can be used on a FOOTNOTE,TITLE, or NOTE statement. */
/******************************************************************************/
options macrogen symbolgen mprint;
data one;
do i=1 to 10;
xvar=ranuni(0);
yvar=ranuni(0);
output;
end;
run;
/* Create output data set TWO from REG procedure */
proc reg data=one outest=two;
model yvar=xvar/ selection=rsquare;
run;
quit;
/* Create a macro variable called RSQ which will resolve to the */
/* rsquare value. */
data _null_;
set two;
call symput('rsq',_RSQ_);
run;
/* Specify the macro variable RSQ in a FOOTNOTE statement */
footnote1 j=L " RSQUARE=&rsq";
symbol1 v=none i=rl c=blue;
axis1 minor=none;
proc gplot data=one;
plot yvar*xvar/regeqn vaxis=axis1 haxis=axis1;
run;
quit;

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 Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Statistical Graph Enhancements
|
| 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 |