1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| /* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Calculate the values for the pie */
proc freq data=age_fini_carte_test2 noprint;
weight NB_EXP;
tables ID*_NAME_ / outpct out=freq2;
run;
/* Create an annotate data set to */
/* draw a pie chart in each state */
data anno2;
/* Get the coordinates for the center of the
state from the MAPS.USCENTER data set */
merge freq2(in=a) maps.france2;
by ID;
/* X and Y coordinate system is set to data values */
xsys='2';
ysys='2';
/* Apply the annotation after the procedure output */
/* Draw a pie */
function='pie';
if _NAME_='EXP_M_40_2010' then color='CX7C95CA';
else if _NAME_='EXP_40_50_2010' then color='CXDE7E6F';
else if _NAME_='EXP_50_60_2010' then color='CX9BFF7F';
else color='CX1A5404';
/* Draw the portion of the pie */
rotate=360*pct_row/100;
size=1;
/* Use a solid pattern fill */
style='solid';
line=0;
run;
pattern1 v=me c=black r=5;
title 'Annotate a pie chart within each state';
/* Generate the map and apply the annotation */
proc gmap data=maps.france
map=maps.france;
id ID;
choro ID / annotate=anno2 nolegend coutline=black;
run;
quit; |
Partager