/**********************************************************************/
/* loop through, generating 101 characters */
do i=0 to 100;
char=input(put(i,hex2.),$2.);
/* segment 1 is a filled polygon */
/* representing the fill level for the character */
segment=1;
lp='p'; /* segment is a polygon */
x=0; y=0; output; /* lower left at 0,0 */
y=i; output; /* upper left is fill level */
x=50; output; /* upper right */
y=0; output; /* lower right */
x=0; output; /* lower left */
/* segment 2 is an empty rectangle, forming the */
/* outline of the gauge */
segment=2;
lp='l'; /* line segments, not a polygon */
y=0; output; /* start at bottom of gauge */
y=100; output; /* upper left at top of gauge */
x=50; output; /* upper right */
y=0; output; /* lower right */
x=0; output; /* lower left */
/* segment 3 is a tick mark on left side of gauge */
/* at 50 percent */
segment=3;
y=50; output;
x=-10; output;
/* segment 4 is a tick mark on right side of gauge */
/* at 50 percent */
segment=4;
x=60; output;
x=50; output;
end;
run;
/**********************************************************************/
libname gfont0 '
/* SAS-data-library */
';
proc gfont data=font name=gauge filled nokeymap
codelen=2 height=3.5;
title 'GAUGE Font';
run;
/**********************************************************************/
data ratio;
input staten $ ratio;
state=stfips(staten); /* convert postal code */
/* to fips code */
cards;
ks 6.0
mo 56.2
ne 44.9
ia 27.9
co 32.2
ut 41.6
wy 49.4
nd 48.2
sd 83.6
mt 62.7
mn 28.6
id 40.4
mi 39.2
il 62.8
in 36.1
oh 39.3
wi 45.7
;
/**********************************************************************/
proc sort;
by state;
run;
/**********************************************************************/
data anno;
length color $ 8;
merge maps.uscenter ratio(in=inr);
by state;
if inr; /* select only states in response */
/* data set */
xsys='2';
ysys='2'; /* use data coordinate system */
function='label'; /* draw gauges using text */
style='gauge'; /* use the gauge font to draw gauges */
when='a'; /* draw gauges on top of map */
position=Õ5Õ; /* center gauge at X-Y location */
text=input(put(round(ratio,1),hex2.),$2.);
/* choose character based */
/* on value of RATIO */
color='black';
size=5;
keep color state x y xsys ysys function
when size position text style;
run;
/**********************************************************************/
title h=8 pct f=swissb 'Debt to Revenue Ratio';
title2 f=swiss h=5 pct 'For Central and Mountain States';
footnote box=2 h=3.5 pct f=gauge '00' f=swissl ' = 0% '
f=gauge '32' f=swissl ' = 50% '
f=gauge '64' f=swissl ' = 100% ';
footnote2 h=3 pct f=swiss j=l ' SAS/GRAPH'
m=(+0,+.5) '02'x m=(+0,-.5) ' Software';
pattern v=s c=grayee r=17;
proc gmap data=ratio map=maps.us all;
id state;
choro state / nolegend /* suppress GMAP legend */
coutline=black /* outline states in black */
cempty=black
annotate=anno;
run;
/**********************************************************************/