data Shape;
;
infile datalines delimiter='09'x dsd firstobs=1;
input Obs Otln id x y vrRng;
datalines;
1 1 1 0 0 10
2 1 1 20 0 10
3 1 1 20 30 10
4 1 1 0 30 10
5 1 1 0 0 10
6 1 2 30 0 5
7 1 2 50 0 5
8 1 2 40 30 5
9 1 2 30 0 5
10 1 3 60 0 15
11 1 3 80 5 15
12 1 3 80 15 15
13 1 3 70 30 15
14 1 3 60 30 15
15 1 3 60 0 15
16 1 4 30 40 25
17 1 4 50 40 25
18 1 4 40 70 25
19 1 4 30 40 25
20 1 5 0 50 10
21 1 5 20 50 10
22 1 5 20 80 10
23 1 5 0 80 10
24 1 5 0 50 10
25 1 3 60 50 .
26 1 3 80 55 .
27 1 3 80 65 .
28 1 3 70 80 .
29 1 3 60 80 .
30 1 3 60 50 .
;
Run;
proc template;
define statgraph Map01t;
begingraph / drawspace=datavalue;
* entrytitle "";
rangeattrmap name="densityrange" ;
range MISSING / rangecolor=gray ;
range MIN - MAX / rangecolormodel=(red orange yellow) ;
endrangeattrmap ;
rangeattrvar attrvar=rangevar var=vrRng attrmap="densityrange";
layout overlayequated / equatetype=equate border=false
xaxisopts=(label=" " display=none)
yaxisopts=(label=" " display=none)
;
polygonplot x=X y=Y id=id / display=(fill)
COLORRESPONSE=rangevar
name="Shape"
;
polygonplot x=X y=Y id=id / display=(outline) OUTLINEATTRS=(color=black) group=Otln;
continuouslegend "Shape" / orient=vertical
location=outside valign=center halign=right
valuecounthint=10 title="Shape";
endlayout;
* entryfootnote halign=left "";
endgraph;
end;
run;
proc sgrender data=Shape template=Map01t;
run;
It would be better (and more flexible) if you define your own LEGENDENTRY using a color swatch of the missing color with the label "Missing" and add it to a DISCRETELEGEND.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.