Procedure features: |
PLOT statement options
|
label variable in plot request |
|
LIST= |
|
PLACEMENT= | |
|
Other features: |
|
This example illustrates the default placement of labels and how to
adjust the placement of labels on a crowded plot. The labels are values of
variable in the data set.(footnote 1)
This example also shows RUN group processing in PROC PLOT.
|
options nodate pageno=1 linesize=120 pagesize=37; |
|
data census;
input Density CrimeRate State $ 14-27 PostalCode $ 29-30;
datalines;
263.3 4575.3 Ohio OH
62.1 7017.1 Washington WA
...more data lines...
111.6 4665.6 Tennessee TN
120.4 4649.9 North Carolina NC
; |
|
proc plot data=census;
plot density*crimerate=state $ state / |
|
box
list=1
haxis=by 1000
vaxis=by 250; |
|
title 'A Plot of Population Density and Crime Rates';
run; |
|
A Plot of Population Density and Crime Rates 1
Plot of Density*CrimeRate$State. Symbol is value of State.
---+------------+------------+------------+------------+------------+------------+------------+---
Density | |
500 + +
| |
| |
| M Maryland |
| |
| |
| |
| |
| |
| D Delaware |
| |
| P Pennsylvania O Ohio |
250 + +
| |
| I Illinois |
| F Florida|
| |
| North Carolina C California |
| TennNssee Georgia |
| N New Hampshire T S South Garolina |
| W West Virginia A Alabama |
| Mississippi M Vermont V M Missouri Washington W T Texas |
| MinneAoArkMnsas O Oklahoma |
| North Dakota I Idaho O Oregon |
0 + S Nouth Dakota N Nevada +
---+------------+------------+------------+------------+------------+------------+------------+---
2000 3000 4000 5000 6000 7000 8000 9000
CrimeRate
NOTE: 7 label characters hidden. A Plot of Population Density and Crime Rates 2
List of Point Locations, Penalties, and Placement States
Vertical Horizontal Starting Vertical Horizontal
Label Axis Axis Penalty Position Lines Shift Shift
Tennessee 111.60 4665.6 2 Center 1 1 -1
South Carolina 103.40 5161.9 2 Right 1 0 2
Arkansas 43.90 4245.2 6 Right 1 0 2
Minnesota 51.20 4615.8 7 Left 1 0 -2
South Dakota 9.10 2678.0 11 Right 1 0 2
| |
|
plot density*crimerate=state $ state /
box
list=1
haxis=by 1000
vaxis=by 250 |
|
placement=((v=2 1 : l=2 1)
((l=2 2 1 : v=0 1 0) * (s=right left : h=2 -2))
(s=center right left * l=2 1 * v=0 1 -1 2 *
h=0 1 to 5 by alt)); |
|
title 'A Plot of Population Density and Crime Rates';
run; |
|
A Plot of Population Density and Crime Rates 3
Plot of Density*CrimeRate$State. Symbol is value of State.
---+------------+------------+------------+------------+------------+------------+------------+---
Density | |
500 + +
| |
| Maryland |
| M |
| |
| |
| |
| |
| Delaware |
| D |
| Pennsylvania Ohio |
| P O |
250 + +
| Illinois |
| I Florida |
| F |
| North Carolina California |
| New South C |
| West Hampshire Alabama N Carolina |
| Virginia N T S G Georgia |
| W Mississippi A Tennessee Washington Texas |
| M Vermont V M Missouri Oklahoma W T |
| South Arkansas A M Minnesota O Oregon |
| Dakota I Idaho Nevada O |
0 + S N North Dakota N +
---+------------+------------+------------+------------+------------+------------+------------+---
2000 3000 4000 5000 6000 7000 8000 9000
CrimeRate
| |
FOOTNOTE 1:
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.