Hi. Here's SAS code that uses tow annotate data sets to show the zip centroids plus your geocoded data. There are not many comments so ask questions if there's code you do not understand.
I have one comment ... rather than use the map data sets in the MAPS library, start uing the maps in the MAPSGFK library. As you can see, if you use MAPSGFK.US_COUNT IES, you no longer have to go through the older method of combining annnotate data with the map/project the combined data/separate the files. Also, you do not have to convert your annotate data lat/long in degrees to radians (HOORAY).
Here's the code and the maps are attached.
* read Harford County data ... create annotate data set ; libname hc 'z:\temp\geocoded_data.xls';
data hc; length color style $20; retain xsys ysys '2' hsys '3' function 'label' color 'green' size 2 style 'wingdings' text '6c'x when 'a' state 24; do until (last); set hc.'geocoded_data$'n (keep=x y _score_) end=last; output; end; * add location of Harford CC (from Google Maps); y = 39.5583912; x =-76.2842196; style = 'wingdings 3'; text = '70'x; size = 6; output; run;
libname hc clear;
* project data set hc; proc gproject data=hc out=anno_hc dupok parmin=mapsgfk.projparm parmentry=us_counties; id state; run;
* find lat/long of zips in Harford County ... create annotate data set; data centroids; retain xsys ysys '2' hsys '3' function 'label' color 'yellow' size 3 style 'wingdings' text 'ab'x when 'a'; set sashelp.zipcode (keep=state county x y); where state eq 24 and county eq 25; run;
* project data set centroids; proc gproject data=centroids out=anno_zip dupok parmin=mapsgfk.projparm parmentry=us_counties; id state; run;
* graphics options ... output to a PNG file; goptions reset=all gunit=pct ftext='calibri' dev=png gsfname=gout xpixels=1500 ypixels=1000;
filename gout 'z:\harford.png';
* draw a map ... two annotate data sets used; proc gmap data=mapsgfk.us_counties map=mapsgfk.us_counties anno=anno_zip; where state eq 24 and county eq 25; id county; choro county / nolegend statistic=first anno=anno_hc; run; quit;
* add a LEGEND to describe the points;
legend1 origin=(3,15)pct value=none shape=bar(.00001,.00001)pct mode=share label=(h=2.5 j=l f='wingdings 3' '70'x f='calibri' ' HARFORD CC' j=l f='wingdings' 'ab'x f='calibri' ' ZIP CENTROIDS' j=l f='wingdings' '6c'x f='calibri' ' GEOCODED (GREEN SCORE 50+, RED SCORE <50)'); filename gout 'z:\harford_leg.png';
* change annotate colors based on gecoding score;
data anno_hc; set anno_hc; select; when (_score_ lt 50) color='red'; when (_score_ ge 50) color='green'; otherwise; end; run;
* draw a map ... two annotate data sets used; proc gmap data=mapsgfk.us_counties map=mapsgfk.us_counties anno=anno_zip; where state eq 24 and county eq 25; id county; choro county / statistic=first legend=legend1 anno=anno_hc; run; quit;
... View more