Generating Graphs


SAS/GRAPH software produces many kinds of charts , plots, and maps in both two-and three-dimensional versions. In addition to helping you understand the variety of graphs that are available to you, these descriptions will also help you choose the correct type of graph for your data and point you to the appropriate chapter.

Charts

SAS/GRAPH software uses the GCHART procedure to produce charts that graphically represent the value of a statistic for one or more variables in a SAS data set. See Chapter 29, The GCHART Procedure, on page 773 for a complete description.

Block charts

Block charts use three-dimensional blocks to graphically represent values of statistics. Block charts are useful for emphasizing relative magnitudes and differences among data values.

click to expand

Horizontal bar charts

Horizontal bar charts use horizontal bars to represent statistics based on the values of one or more variables. Horizontal bar charts can generate a table of chart statistics and are useful for displaying exact magnitudes and emphasizing differences.

click to expand

Vertical bar charts

Vertical bar charts use vertical bars to represent statistics based on the values of one or more variables. Vertical bar charts, which generate only one statistic, are useful for displaying exact magnitudes and emphasizing differences.

click to expand

Pie charts, 3-D Pie charts, and Donut charts

Pie charts, 3-D Pie charts, and Donut charts use the angle of pie slices to graphically represent the value of a statistic for a data range. Pie charts are useful for examining how the values of a variable contribute to the whole and for comparing the values of several variables.

click to expand

Star charts

Star charts use the length of spines to graphically represent the value of a statistic for a data range. Star charts are useful for analyzing where data are out of balance.

click to expand

Two-Dimensional Plots

SAS/GRAPH software uses the GPLOT procedure to produce two-dimensional graphs that plot one or more dependent variables against an independent variable within a set of coordinate axes. GPLOT can display the data points as individual symbols (as in a scatter plot), or use interpolation methods specified by the SYMBOL statement to join the points, request spline interpolation or regression analysis, produce various high-low plots, or generate several other types of plots.

GPLOT can also display data as bubble plots in which circles of different sizes represent the values of a third variable.

Plots are useful for demonstrating the relationship between two or more variables and frequently compare trends or data values or depict movements of data values over time.

See Chapter 37, The GPLOT Procedure, on page 1081 for a complete description.

Two-dimensional scatter plots

Two-dimensional scatter plots show the relationship of one variable to another, often revealing concentrations or trends in the data. Typically, each variable value on the horizontal axis can have any number of corresponding values on the vertical axis.

click to expand

Simple line plots

Simple line plots show the relationship of one variable to another, often as movements or trends in the data over a period of time. Typically, each variable value on the horizontal axis has only one corresponding value on the vertical axis. The line connecting data points can be smoothed using a variety of interpolation methods, including the Lagrange and the cubic spline interpolation methods.

click to expand

Regression plots

Regression plots specify that the plot is a regression analysis. You can specify one of three types of regression equation “ linear, quadratic, or cubic “ and optionally display confidence limits for mean predicted values or individual predicted values.

click to expand

High-low plots

High-low plots show how several values of one variable relate to one value of another variable. Typically, each variable value on the horizontal axis has several corresponding values on the vertical axis. High-low plots include box, needle, and stock market plots.

click to expand

Bubble plots

Bubble plots show the relative magnitude of one variable in relation to two other variables. The values of two variables determine the position of the bubble on the plot, and the value of a third variable determines the size of the bubble.

click to expand

Three-Dimensional Plots

SAS/GRAPH software uses the G3D procedure to produce three-dimensional surface and scatter plots that examine the relationship among three variables. Variable values are plotted on a set of three coordinate axes.

See Chapter 46, The G3D Procedure, on page 1295 for a complete description.

Surface plots

Surface plots are three-dimensional plots that display the relationship of three variables as a continuous surface. Surface plots examine the three-dimensional shape of data.

click to expand

Scatter plots

Scatter plots enable you to examine three-dimensional data points instead of surfaces and to classify your data using size, color , shape, or a combination of these features.

click to expand

Contour plots

SAS/GRAPH software uses the GCONTOUR procedure to examine three-dimensional data in two dimensions. Lines or areas in a contour plot represent levels of magnitude ( z ) corresponding to a position on a plane ( x,y ).

See Chapter 30, The GCONTOUR Procedure, on page 885 for a complete description.

Contour plots are two-dimensional plots that show three-dimensional relationships. These plots use contour lines or patterns to represent levels of magnitude of a contour variable plotted on the horizontal and vertical axes.

click to expand

When you need to interpolate or smooth data values that are used by the G3D and GCONTOUR procedures, use the G3GRID procedure. The G3GRID procedure does not produce graphics output but processes existing data sets to create data sets that the G3D or GCONTOUR procedure can use to produce three-dimensional surface or contour plots. See Chapter 47, The G3GRID Procedure, on page 1327 for a complete description.

Maps

SAS/GRAPH software uses the GMAP procedure to produce two- and three-dimensional maps that can show an area or represent values of response variables for subareas.

SAS/GRAPH software includes data sets to produce geographic maps. In addition, you can create your own map data sets.

See Chapter 35, The GMAP Procedure, on page 995 for a complete description.

Block maps

Block maps are three-dimensional maps that represent data values as blocks of varying height rising from the middle of the map areas.

click to expand

Choropleth maps

Choropleth maps are two-dimensional maps that display data values by filling map areas with combinations of patterns and color that represent the data values.

click to expand

Prism maps

Prism maps are three-dimensional maps that display data by raising the map areas and filling them with combinations of patterns and colors.

click to expand

Surface maps

Surface maps are three-dimensional maps that represent data values as spikes of varying heights.

click to expand

SAS/GRAPH software also provides several utility procedures for handling map data.

The GPROJECT procedure lets you choose how geographic maps are projected . This is particularly important for large areas because producing a map of any large area on the Earth involves distorting some areas in the process of projecting the spherical surface of the Earth onto a flat plane. You can use the procedure to select the projection method that least distorts your map.

Map areas are constructed of joined data points. Each data point represents an observation in a SAS data set. For large maps, the amount of data can be prohibitively expensive (in terms of computing resources or time to process); the GREDUCE procedure enables you to reduce the number of points in the data set. The GREMOVE procedure enables you to remove boundary lines within a map.

Creating Text Slide and Presentation Graphics

You can use SAS/GRAPH software to create slide presentations of your graphs. With SAS/GRAPH you can

  • create text slides with the GSLIDE and GPRINT procedures

  • combine several graphs into one output with the GREPLAY procedure

  • automatically or manually replay your graphs and text slides with the GREPLAY procedure.

Text Slides

Use the GSLIDE procedure to create text slides in which you can specify a variety of colors, fonts, sizes, angles, overlays, and other modifications as well as drawing lines and boxes on the output.

See Chapter 44, The GSLIDE Procedure, on page 1277 for a complete description.

Text slides display text as graphics output. Text slides can be used as title slides for presentations, or to produce certificates, signs, or other display text.

click to expand

Use the GPRINT procedure to display as a graphic SAS procedure output that has been saved in a text file. With GPRINT, you bring the text file into SAS/GRAPH and then add titles, notes, and footnotes, and select colors for the output.

See Chapter 38, The GPRINT Procedure, on page 1147 for a complete description.

Combining Output into One Slide

Use the GREPLAY procedure to combine several graphs into a single output. You can create special effects by overlaying or rotating the graphs at any angle.

Templated graphs display two or more graphs or text slides as one output by replaying stored graphs into a template or framework. Like graphs and text slides, templated graphs can be ordered in groups and stored in catalogs for replay as part of a presentation.

click to expand
Figure 1.1: Templated graphs

In addition, you can use the GREPLAY procedure to create an automated or user -controlled presentation of graphics output. The GREPLAY procedure enables you to name , arrange, and customize the presentation of graphs that are stored in a catalog.

See Chapter 43, The GREPLAY Procedure, on page 1237 for a complete description.

Enhancing Graphics Output (graphs and text slides)

SAS/GRAPH Statements

You also can use global statements and graphics options in SAS/GRAPH programs. With global statements, you can add titles and footnotes and control the appearance of axes, symbols, patterns, and legends. With graphics options, you can control the appearance of graphics elements by specifying default colors, fill patterns, fonts, text height, and so on.

The Annotate Facility

The Annotate facility enables you to program graphics by using certain variables in SAS data sets. It is often used to add text or special elements to the graphics output of other procedures, although it also can be used to construct custom graphics output. Text and graphics can be placed at coordinates derived from input data, as well as coordinates expressed as explicit locations on the display.

click to expand
Figure 1.2: Annotated graphs

Creating Custom Graphics

The Annotate facility can also be used to generate custom graphics without using any of the SAS/GRAPH graphing procedures.

The DATA Step Graphics Interface

The DATA Step Graphics Interface provides functions and calls that produce graphics output from the DATA step, rather than from a procedure. The functions and calls are similar in form to those specified by the ISO Graphic Kernal Standard (GKS); however, the interface is not an implementation of the GKS. The form is similar enough that many GKS-compliant programs may be converted easily to run as SAS/GRAPH programs.

Graph-N-Go

To generate presentation graphs without writing any SAS/GRAPH code, you can use Graph-N-Go (not available on mainframes). You can start Graph-N-Go in several ways:

  • from the menus in any SAS window, select

    click to expand
  • submit either of the following from the SAS command line:

     gng  graphngo 
  • use an Explorer window to directly open a GFORM entry. Double-click (or right-click and choose Open ) on a GFORM entry to start a Graph-N-Go session using that entry.

Information on using the application is in Graph “N-Go help, which you can access from the application s main window in either of two ways:

  • select

    click to expand
  • press F1 (this may not work in some operating environments).

You can also get help for the application by submitting the following command from the SAS command line:

 help gng 



SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net