Mapping In SAS

Screen Shot 2016-11-10 at 8.41.41 PM.png

Color coded maps by spacial representation of zip code can be used to visually show count data.  The map above of Louisiana shows the number of members with a particular disease in the network.

 

The following SAS code is an example of creating a zip map.

/* Used to create zip maps */
proc mapimport
datafile=”Saved map from census
out=mymap;
id zcta;
run;

data mymap; set mymap;
/* Convert long/lat to radians */
x=atan(1)/45 * x;
y=atan(1)/45 * y;
run;

data mymap; set mymap;
segment=(100*ZT22_D00_I)+segment;
run;
proc gproject data=mymap out=mymap dupok eastlong project=robinson;
id zcta;
run;

PROC IMPORT OUT= WORK.pain DATAFILE= “Excel file of zip code and count
DBMS=xls REPLACE;
SHEET=”Sheet1″;
GETNAMES=YES;
RUN;

proc gmap data=WORK.pain map=work.mymap all;
id zcta;
choro counts / nolegend cempty=silver CDEFAULT=white;
run;

goptions reset = all;
goptions cback=white gunit=pct htitle=6 htext=4 ftitle=”arial/bo” ftext=”arial”;
GOPTIONS xpixels=1024 ypixels=768 DEVICE=png;
ODS LISTING CLOSE;
legend1 label=none shape=bar(3,3) position=(left middle) across=1;

/* This is what creates the surface map */
proc gmap data=WORK.pain map=work.mymap all;
id zcta;
surface counts / rotate =75 tilt= 45 nlines=100 constant=30 cbody=purple;
run;
quit;
proc gmap data=WORK.pain map=work.mymap all;
id zcta;
pattern1 v=ms c=cxEDF8FB;
pattern2 v=ms c=cxB3CDE3;
pattern3 v=ms c=cx8C96C6;
pattern4 v=ms c=cx88419D;
choro counts / midpoints= 2 6 50 200 legend=legend1 range cempty=silver CDEFAULT=white ;
run;
quit;
ODS LISTING;

/*Find midpoints */
PROC IMPORT OUT= zip DATAFILE= “Excel file of zip code and count
DBMS=xls REPLACE;
SHEET=”Sheet1″;
GETNAMES=YES;
RUN;
proc univariate Data=zip;
var counts;
run;

dm “log; clear; output; clear; odsresults; clear;”;
dm “odsresults; clear;”;


Leave a comment