SAS Author's Tip: PLOT and PLOT2 Statements

1

contributed by SAS Publishing's Shelly Goodin

This week's featured SAS Author's Tip is a no-brainer. With the summer heat wave in North Carolina reaching an almost unbearable level, it's cool to have Robert A. Rutledge's book Just Enough SAS on hand. This accessible guide quickly brings new SAS users up to speed while giving experienced users tips for improving coding. Whether you're in Siberia, a tropical island, the Pacific Northwest, or scorching Cary, North Carolina--Robert's straightforward delivery will thrive in any climate.

The following excerpt is from SAS Press author Robert A. Rutledge's book Just Enough SAS: A Quick-Start Guide to SAS for Engineers, Copyright © 2009, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)

The Basic Forms of the PLOT and PLOT2 Statements

PROC GPLOT can be used to create scatter plots or line plots of the values in a data set. Each plot point is determined by the values of two variables in the same row of the data set. A variable which is plotted on the horizontal axis is referred to as an X variable, and a variable which is plotted on the vertical axis is referred to as a Y variable. Using this notation, the PLOT and PLOT2 statements can be used to create five basic forms of plot:

1. A simple scatter plot or line plot of Y vs. X.
2. Separate plots of Y vs. X, on separate graphs, for each value of a third variable Z.
3. Separate plots of Y vs. X, on the same graph, for each value of a third variable Z.
4. Plots of two or more Y variables vs. X, using the same Y axis. Or two or more X variables vs. the same Y variable, using the same X axis.
5. Plots of two or more Y variables vs. X, using two different Y axes. Or two or more X variables vs. the same Y variable, using two different X axes.

For more information about the book, including a free chapter, visit Robert Rutledge's author page!

Share

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

Back to Top