Sample 42864: Scatter plot of groups with an overall regression line
This sample illustrates how to generate a scatter plot of groups overlaid with an overall regression line using the GPLOT procedure.
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 illustrates how to generate a scatter plot of groups overlaid with an overall regression line using the GPLOT procedure. The PLOT statement generates the scatter plot of groups; the PLOT2 statement generates an overall regression line for all groups.
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=10pt;
/* Define the title */
title1 "Scatter Plot of Groups with an Overall Regression Line";
/* Define the axis characteristics */
axis1 label=("Weight");
axis2 label=(angle=90 "Height") minor=(n=4);
/* Define the symbol characteristics for the scatter plot groups */
symbol1 interpol=none value=dot color=depk;
symbol2 interpol=none value=dot color=vibg;
/* Define the symbol characteristics for the regression line */
symbol3 interpol=rl value=none color=black;
/* Define the legend options */
legend1 frame label=none repeat=1
value=("Female" "Male");
proc gplot data=sashelp.class;
plot height*weight=sex / haxis=axis1 vaxis=axis2 legend=legend1;
plot2 height*weight / noaxis;
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 illustrates how to generate a scatter plot of groups overlaid with an overall regression line using the GPLOT procedure.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Plots ==> Other Plots
|
Date Modified: | 2011-04-04 15:53:47 |
Date Created: | 2011-04-04 15:38:45 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
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 | |
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 | |