 ">
/********************************************************
* This sample code will project a US state separately. *
* It expects the 2-char alpha FIPS code as input. Cut *
* and paste this SAS code into your SAS Program Editor *
* and Submit to see sample output. *
* NOTES: although we are passing in the alpha code for *
* a state, the MAPS.COUNTIES dataset contains *
* the numeric FIPS number for the state. *
* stfips("&state") converts the alpha code to numeric *
* stnamel("&state") converts the alpha code to the *
* long name for the state. *
********************************************************/
%macro stateprj(state);
data state;
set maps.counties(where=(state=stfips("&state")));
call symput('stname',stnamel("&state"));
run;
proc gproject data=state out=stateprj;
id state;
run;
proc gmap map=stateprj data=stateprj;
id state county; choro county/discrete nolegend;
title "&stname" c="green";
pattern v=e r=300 c="blue";
run;
%mend;
/*******************************************************
* state examples *
*******************************************************/
%stateprj(TX);
%stateprj(NC);
%stateprj(ID);
/*******************************************************
* submit a statement like the one below to see a map *
* of the state of your choice. *
*******************************************************/
%stateprj(UT);
|