Creating Graphs

Example: Create a 2-D Scatter Plot

Open the Fitness Data Set

In this example, you use the Fitness data set as the basis of your scatter plot. If you have not already done so, open the Fitness data set by following these steps:
  1. Select Tools arrow Sample Data ...
  2. Select Fitness.
  3. Click OK to create the sample data set in your Sasuser directory.
  4. Select File arrow Open By SAS Name ...
  5. Select Sasuser from the list of Libraries.
  6. Select Fitness from the list of members.
  7. Click OK to bring the Fitness data set into the data table.

Specify Scatter Plot Variables

To specify the variables to be plotted, follow these steps:
  1. Select Graphs arrow Scatter Plot arrow Two-Dimensional ...
  2. Select age from the candidate list, and click X Axis to make age in years the x-axis variable.
  3. Select runtime from the candidate list, and click Y Axis to make minutes to run 1.5 miles the y-axis variable.

    Scatter Plot Variables

    Figure 5.35: Scatter Plot Variables

Specify Scatter Plot Display Options

To specify your scatter plot display options, follow these steps:
  1. Click on the Display button to display the Scatter Plot Display dialog.
  2. Under Plotted points, click on the Point Color button. Select Red from the list of colors to make your scatter plot points red. Click OK.
  3. Click on the down arrow next to Point symbol: and select DOT from the list. This makes your scatter plot points display as dots.
  4. Under Axes, select Add reference lines at major tick marks. This displays a grid on the scatter plot by which you can orient the points on the axes.

    Display Options

    Figure 5.36: Display Options

  5. Click OK to save your display changes.

Specify Scatter Plot Titles

To specify the titles for your scatter plot, follow these steps:
  1. Click on the Titles button in the Scatter Plot dialog.
  2. In the Scatter Plot tab, type Age versus Runtime in the first field.

    Scatter Plot Title

    Figure 5.37: Scatter Plot Title

  3. If you did not change the global title in the first exercise in this chapter, click on the Global tab. Type Fitness Report in the first field. This global title is saved across all Analyst sessions until you change it.

    Global Title

    Figure 5.38: Global Title

  4. Click OK to save your title changes.

Generate Scatter Plot

To display your scatter plot, click OK in the Scatter Plot dialog.

2-D Scatter Plot

Figure 5.39: 2-D Scatter Plot

Previous | Next | Top of Page