Assigning Data to a Plot

About Assigning Data to a Plot

You are prompted to assign plot data when you first create a graph from the Graph Gallery or when you click and drag a plot to a graph. You can later change the data after a plot has been created. For the predefined graphs in the Graph Gallery, the designer uses data from the WORK, SASHELP, or SASUSER library.
You assign data in the Assign Data dialog box. The fields on this dialog box vary with the type of graph that you are creating. The following display shows the Assign Data dialog box when a step plot is dragged to a graph.
Assign Data dialog box
If you are creating a heterogeneous multi-cell graph, then you assign data for each cell individually.

Assign Data to a Plot

To assign data to a plot:
  1. Open the Assign Data dialog box if it's not already open. To open this dialog box, right-click an existing plot and select Assign Data.
  2. Assign the SAS library and data set that you want to use for the plot. The process for assigning this information differs depending on how the Assign Data dialog box is opened, as described here:
    • The Assign Data dialog box is opened automatically when you click and drag a plot icon to the graph.
      Specify the SAS library and data set that you want to use for the plot by selecting the appropriate items from the Library and Data Set list boxes. The library and data set can be assigned only for the first plot that you click and drag. For subsequent plots, these fields are dimmed.
    • You open the Assign Data dialog box by right-clicking a plot and selecting Assign Data.
      Note: When you click or right-click a plot, the plot remains in full color. Any other plots in the graph appear dimmed.
      1. You can change the SAS library and data set by selecting the appropriate items from the Library and Data Set list boxes. If you change the library or data set, you must specify the variables as described in step 4.
      2. From the Plot list box, select the plot for which you want to set variables.
  3. Check the Fit an existing plot check box if you want to match the variables of the plot to those of another plot. This check box is available only for specific plot types that are overlaid on an existing plot.
  4. In the Variables section, specify the variable values for the plot. For more information about the variables, see Summary of Plot Data.
  5. If you want a more descriptive name for the plot, enter the name in the Name field. This name identifies the plot in the Assign Data dialog box as well as in the Cell Properties dialog box.
    By default, the designer uses generic names for each plot. It is good practice to assign a descriptive name that indicates a response variable or some identifying characteristic of the plot.
  6. (Optional) Specify use of a secondary axis for the X axis, the Y axis, or both X and Y axes.
  7. If the Advanced Options button is enabled, you can click this button to specify additional options.
  8. If the graph contains another plot, select it from the Plot list box and then set variables for the plot. Repeat this step for each plot in the graph.
Note: If you are designing a classification panel, then click the Panel Variables tab and select the classification variable(s). For more information, see Creating a Classification Panel.

Summary of Plot Data

In the Assign Data dialog box, you specify the variable values for the plot. The variables that are available depend on which type of plot you are designing.
The following list summarizes the data that you can specify for plots:
X, Y, or Z-Axis Variables
For most of the plots, you specify the variable for the X axis, the Y axis, or both axes. For the contour plot, you also specify the variable for the Z axis.
Group Variable
Several types of plots enable you to specify a variable for grouping the data. Scatter plots, series plots, step plots, bar charts, and vector charts support this option in the designer.
For example, if you specify a group variable of GENDER in a scatter plot, then the plot marker colors are different for men and for women.
Data Label, Curve Label
You can display the data label for each observation in a scatter plot, and a curve label for a series or a step plot.
For scatter plots, you select the variable that you want to use for labels.
For series and step plots, you type the text that you want to appear next to the plot curve. If you have specified a group variable, then you select the label from a list box.
Error Upper, Error Lower
Some plots can display the upper and lower error (or confidence or prediction) limits for the data. You compute these values and supply them as variables to the plot.
You can specify error upper and error lower variables for scatter plots, step plots, and bar error plots. For scatter plots, you can specify the variables for both the X and the Y axis. You might need to click the More Variables button to enter these variables.
Connect Order
This option is available for plots such as series or step plots. The connect order specifies how to connect the data points to form the step line. Select X Axis to connect data points as they occur minimum-to-maximum along the X axis. Select X Values to connect data points in the order read from the X variable. X Axis is the default.
To access this option when assigning data for series or step plots, click the Advanced Options button.
Bar Chart Data
For bar charts, you provide a category variable and an optional response variable. If you don't specify a response variable, then the designer displays the frequency chart for the category variable.
Here are additional options:
  • The Group option creates a separate stacked bar segment for each unique group value of the specified variable.
  • The URL option enables a URL link to be associated with each bar or bar segment. If the graph is saved as an HTML output file, then clicking on each bar navigates to the specified HTML page. Here's an example URL:
    http://www.sas.com/technologies/analytics/index.html
    For grouped data, the values of the variable are expected to be the same for each unique X and group combination.
  • You can specify the statistic to be computed for the Y axis. The default statistic is FREQ.
Vector Origin Data
For vector plots, in addition to the X and Y variables, you can specify the vector origin. You can specify the X data coordinate of the vector origin and the Y data coordinate of the vector origin. If you don't specify the coordinate, a value of 0.0 is used.
To specify a value, select Constant: <type value> from the XOrigin or the YOrigin list box. They type the coordinate value.
Contour Data
For a contour plot, you must specify gridded data for the contour X and Y variables, with a Z value for each (X,Y) crossing.
The Contour Type list box enables you to specify how the contour is displayed as follows:
Line displays contour levels as unlabeled lines.
Fill displays the area between the contour levels as filled. Each contour interval is filled with one color.
Gradient displays a smooth gradient of color to represent contour levels.
LineFill combines the Line and Fill types. Each contour interval is filled with one color. Displays contour levels as unlabeled lines.
LineGradient combines the Line and Gradient types. Displays contour levels as unlabeled lines.
LabeledLine adds labels to the Line type. Displays contour levels as labeled lines.
LabeledLineFill adds labels to the LineFill type. Each contour interval is filled with one color. Displays contour levels as lines with labels showing contour level values.
LabeledLineGradient adds labels to the LineGradient type. Displays contour levels as lines with labels showing contour level values.
Loess, Regression, and PBSpline Model Band Data
You can select the Fit an existing plot check box to match the variables of an overlaid loess, regression, or PBSpline (penalized B-spline) plot to those of another plot.
You can also enable the following model band options:
CLM creates confidence limits. This option is available for all three plots. The confidence level is set by the Alpha option.
CLI produces confidence limits for individual predicted values for each observation. This option is available for regression and PBSpline plots. The confidence level is set by the Alpha option.
When you enable the CLM or CLI option, you can specify the following by clicking Advanced Options:
Alpha specifies the confidence level to compute. The default is 0.05, which represents a 95% confidence level.
Degree specifies the degree of the polynomial that is computed. A degree of one produces a linear fit, a degree of two produces a quadratic fit, and so on. For loess plots, you can specify a degree of one (default) or two. For regression and PBSpline plots, you can specify a degree of one through five.
Interpolation specifies the degree of the interpolating polynomials that are used for blending local polynomial fits at the vertices. This value is used with loess plots. Possible choices are Linear (default) and Cubic.