Previous Page | Next Page

The PLOT Procedure

Example 9: Adding Labels to a Plot


Procedure features:

PLOT statement

label variable in plot request

Data set: EDUCATION

This example shows how to modify the plot request to label points on the plot with the values of variables. This example adds labels to the plot shown in Plotting BY Groups.


Program

 Note about code
options nodate pageno=1 linesize=80 pagesize=35;
 Note about code
proc sort data=education;
   by region;
run;
 Note about code
proc plot data=education;
   by region;
 Note about code
   plot expenditures*dropoutrate='*' $ state / href=28.6;
 Note about code
   title 'Plot of Dropout Rate and Expenditure Per Pupil';
run;

Output

 Note about figure
                 Plot of Dropout Rate and Expenditure Per Pupil                1

---------------------------------- Region=MW -----------------------------------

          Plot of Expenditures*DropoutRate$State.  Symbol used is '*'.

    Expenditures |                                                  |
            5500 +                                                  |
                 |                                                  |
                 |                                                  |
                 |                                                  |
                 |                                           Michigan *
            5000 +                                                  |
                 |                                * Illinois        |
                 |      * Minnesota                                 |
                 |                                                  |
                 |                                       * Ohio     |
            4500 +                                                  |
                 |            * Nebraska * Kansas                   |
                 |      Iowa ** Indiana                        * Missouri
                 |                                                  |
                 |                                                  |
            4000 +       * North Dakota                             |
                 |                                                  |
                 |                                                  |
                 |                                                  |
                 |                                                  |
            3500 +                                                  |
                 |                                                  |
                 ---+------------+------------+------------+------------+--
                   10           15           20           25           30

                                  Dropout Percentage - 1989

                 Plot of Dropout Rate and Expenditure Per Pupil                2

---------------------------------- Region=NE -----------------------------------

          Plot of Expenditures*DropoutRate$State.  Symbol used is '*'.

    Expenditures |                                     |
            8000 +                                     |
                 |                                     |
                 |                * New Jersey         |
                 |                                     |
                 |                                     |
            7000 +                                     |
                 |       * Connecticut                 |
                 |                                     |
                 |                                     |
                 |                                     |
            6000 +                                    *|Massachusetts
                 |                               * Maryland
                 |                                     |
                 |                                     * Delaware
                 |                                     |
            5000 +                                     |
                 |                      * Maine * New Hampshire
                 |                                     |
                 |                                     |
                 |                                     |
            4000 +                                     |
                 |                                     |
                 ---+------------+------------+------------+------------+--
                   15           20           25           30           35

                                  Dropout Percentage - 1989

NOTE: 1 obs had missing values.

Previous Page | Next Page | Top of Page