Previous Page | Next Page

Plotting the Relationship between Variables

Plotting One Set of Variables


Understanding the PLOT Statement

The PLOT procedure produces two-dimensional graphs that plot one variable against another within a set of coordinate axes. The coordinates of each point on the plot correspond to the values of two variables. Graphs are automatically scaled to the values of your data, although you can control the scale by specifying the coordinate axes.

You can create a simple two-dimensional plot for one set of measures by using the following PLOT statement:

PROC PLOT <DATA=SAS-data-set>;
PLOT vertical*horizontal;
where vertical is the name of the variable to plot on the vertical axis and horizontal is the name of the variable to plot on the horizontal axis.

By default, PROC PLOT selects plotting symbols. The data determines the labels for the axes, the values of the axes, and the values of the tick marks. The plot displays the following:

The following display shows the axes, values, and tick marks on a plot.

Diagram of Axes, Values, and Tick Marks

[Diagram of Axes, Values, and Tick Marks]

Note:   PROC PLOT is an interactive procedure. After you issue the PROC PLOT statement, you can continue to submit any statements that are valid with the procedure without resubmitting the PROC statement. Therefore, you can easily and quickly experiment with changing labels, values for tick marks, and so on.  [cautionend]


Example

The following program uses the PLOT statement to create a simple plot that shows the trend in high Dow Jones values from 1954 to 1998:

options pagesize=40 linesize=76 pageno=1 nodate;

proc plot data=highlow;
   plot DowJonesHigh*Year;
   title 'Dow Jones Industrial Average Yearly High';
run;

The following output shows the plot:

Using a Simple Plot to Show Data Trends

                  Dow Jones Industrial Average Yearly High                 1

       Plot of DowJonesHigh*Year.  Legend: A = 1 obs, B = 2 obs, etc.

   DowJonesHigh |
                |
          10000 +
                |
                |                                                  A
                |
                |                                                 A
           8000 +
                |
                |
                |
                |                                                A
           6000 +
                |
                |                                               A
                |
                |
           4000 +                                              A
                |                                            AA
                |                                           A
                |                                       A AA
                |
           2000 +                                      A A
                |                                     A
                |                        AA  A   AAAAA
                |           AAAAAAAAAAAAA  AA AAA
                |      AAAAA
              0 +
                |
                ---+---------+---------+---------+---------+---------+--
                 1950      1960      1970      1980      1990      2000

                                          Year
The plot graphically depicts the exponential trend in the high value of the Dow Jones Industrial Average over the last 50 years. The greatest growth has occurred in the last 10 years, increasing by almost 6,000 points.

Previous Page | Next Page | Top of Page