Procedure features: |
PLOT statement options
|
label variable in plot request |
|
PLACEMENT= | |
|
Data set: |
CENSUS
|
This example illustrates the default placement of labels and uses a
macro to adjust the placement of labels. The labels are values of a variable
in the data set.
|
options nodate pageno=1 linesize=120 pagesize=37; |
|
%macro place(n);
%if &n > 13 %then %let n = 13;
placement=(
%if &n <= 0 %then (s=center); %else (h=2 -2 : s=right left);
%if &n = 1 %then (v=1 * h=0 -1 to -2 by alt);
%else %if &n = 2 %then (v=1 -1 * h=0 -1 to -5 by alt);
%else %if &n > 2 %then (v=1 to 2 by alt * h=0 -1 to -10 by alt);
%if &n > 3 %then
(s=center right left * v=0 1 to %eval(&n - 2) by alt *
h=0 -1 to %eval(-3 * (&n - 2)) by alt *
l=1 to %eval(2 + (10 * &n - 35) / 30)); )
%if &n > 4 %then penalty(7)=%eval((3 * &n) / 2);
%mend; |
|
proc plot data=census;
plot density*crimerate=state $ state / |
|
box
list=1
haxis=by 1000
vaxis=by 250
%place(4); |
|
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 |
| N Tennessee |
| N New Hampshire T S G Georgia |
| W West Virginia Alabama A South Carolina |
| Mississippi M Vermont V M Missouri Washington W T Texas |
| Arkansas A M Minnesota O Oklahoma |
| South Dakota I Idaho O Oregon |
0 + S N North Dakota N Nevada +
---+------------+------------+------------+------------+------------+------------+------------+---
2000 3000 4000 5000 6000 7000 8000 9000
CrimeRate
| |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.