Major Graphing Procedures in SAS

Summary of SAS Graphing Modules

There are many graphing procedures in SAS. Some major examples, which can be used for many purposes, include the following:
  • PROC SGPLOT: This SAS routine creates single graphs of many different types.
  • PROC SGPANEL: The SAS routine allows you to create grids of many graphs at the same time.
  • PROC GKPI: This is a particularly useful tool for business. It allows the user to create a variety of simple but evocative dashboard graphics, which are commonly used in business reporting.
  • PROC GMAP: This is a powerful tool for graphing data involving geographic information system presentations, notably data displayed geographically by using maps.
  • PROC SGSCATTER: This is a special tool for creating scatter graphs of many pairs of variables at the same time.
There are many other graphing routines in SAS. SAS/GRAPH® contains many older routines (such as PROC GPLOT) that have largely been overtaken by the above major options. In addition, as we have already seen, many analysis procedures such as PROC UNIVARIATE create their own specific graphs.
Note that, unfortunately, the SAS Studio free version does not offer the procedures associated with SAS/GRAPH, including PROC GKPI and PROC GMAP. SAS 9 will include these if you have included SAS/GRAPH in your package.
Before going on to examine concrete examples and code, read the following two sections, which briefly discuss two features of graphing in SAS.

Flexibility in SAS Graphing Code

SAS graphing – especially using the ODS Graphics engine – is an almost endlessly flexible set of coding, that can range from simple to more complex options. Within any given graphing procedure, you are given the ability to change anything in the graph, such as:
  • Change, move or remove titles on graphs, axes, and elements in the graph.
  • Alter the look of the graphing area (e.g. changing, moving or removing axes, adding color to the background, and so on).
  • Change the core graph elements (for example, in a line chart, changing the look of the line in many ways).
These are just a few of the many things you can achieve. You can also use SAS to build bespoke graphs of your own choosing from scratch.
The key thing for the beginner is probably to use the code examples given in this book and the SAS helpfiles and books (especially SAS 9.4 ODS Graphics: Procedures Guide, Third Edition and SAS/GRAPH 9.4 User’s Guide) to start building a graph. Thereafter, desired changes can be made by reading through the “Syntax” section of each helpfile. Sometimes this takes a little time, application and trial-and-error, but it is inevitably worth it to produce a scintillating graph.

Black-and-White Versus Color Graphs

SAS may produce your graphics in either black-and-white or color, depending on the ODS style you are using. ODS refers to Output Delivery System, the engine that SAS uses to create output, which I introduced in Chapter 6.
With ODS, you can get SAS to write reports to HTML files, Rich Text Files (that will open as Microsoft Word or similar files), PDF files, and the like. In this book I have suggested using an HTML “Journal” style for most output, as this creates clean black-and-white tables. However, the Journal styles do make graphs black-and-white, whereas in graphs, we often want color.
To create color graphs, change your HTML results style to “HTMLBLUE” or the like. You can change back to Journal later if you wish. You can change the style using the instructions about changing SAS preferences in Chapter 6.

Placing Annotations in Graphs

Many of the SAS graphing routines also have a powerful feature called annotation. This allows you to insert practically anything of your choice into a graph. Examples are:
  • Specific text that you want to put in a specific place in the graph area, perhaps explanatory text in red that helps to tell the story in the graph.
  • An arrow pointing at a part of the graph, which would draw the reader’s attention to that spot.
  • A graphic inserted into the graphing area, perhaps because you wish to associate a data point with a brand logo.
  • And so on – there are many options!
This book will not cover how to do annotation, but the interested reader will quickly be able to pick up the necessary skills in the SAS helpfiles and guides.
Last updated: April 18, 2017
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.121.8