Chapter 30
Plotting the Relationship between
Variables
Introduction to Plotting the Relationship between Variables . . . . . . . . . . . . . . . . . 531
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
Input File and SAS Data Set for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
Plotting One Set of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Understanding the PLOT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Enhancing the Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Specifying the Axes Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Specifying the Tick Marks Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Specifying Plotting Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Removing the Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Plotting Multiple Sets of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Creating Multiple Plots on Separate Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Creating Multiple Plots on the Same Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
Plotting Multiple Sets of Variables on the Same Axes . . . . . . . . . . . . . . . . . . . . . . 546
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
PROC PLOT Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Learning More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Introduction to Plotting the Relationship between
Variables
Overview
An effective way to examine the relationship between variables is to plot their values.
You can use the PLOT procedure to display relationships and patterns in the data.
This section covers the following topics:
plot one set of variables
enhance the appearance of a plot
create multiple plots on separate pages
531

Get Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.