Download presentation
Presentation is loading. Please wait.
Published byPeter Marshall Modified over 8 years ago
1
CMS SAS Users Group Conference Learn more about THE POWER TO KNOW ® October 17, 2011 PROC GMAP, HTML and You Thomas Kornfield, CMS
2
Organization of Presentation Basics of PROC GMAP How to enhance appearance of maps Create maps with alternative groupings of data Create HTML maps with drill down capabilities 2
3
What PROC GMAP Does Can be used to show data patterns by various levels of geography Creates two and three dimensional maps Three main types of maps – Choropleth, basic two dimensional map – Prism map, three dimensional map – Surface map This presentation will look only at choropleth maps 3
4
PROC GMAP Syntax PROC GMAP MAP=map-data-set DATA=response-data-set ID id-variable(s); CHORO response-variable(s) / ; RUN; QUIT; include: Discrete, Legend, Annotate 4
5
Basic Example proc sort data=maps.us out=us (keep=state) nodupkey; by state; run; data us2; set us; /* use MOD function to get even numbered states * if mod(state,2)=0 then type=1; else type=2; run; proc gmap data=us2 map=maps.us; id state; choro type/nolegend; run; quit; 5
6
Map Patterns PATTERN c= v= – x is the pattern number, max is 20 V=s for solid colors V=m where – y=number of lines – c=n or x, n means lines are to be drawn at an angle, x means lines are criss-crossed – z=angle to draw lines http://www.colorbrewer.com is an excellent source for map colors http://www.colorbrewer.com 6
7
Example of Map Patterns Maryland County Population, 2010 pattern1 v=s c=red; pattern2 v=m1n00 c=blue; pattern3 v=m3n90 c=black; pattern4 v=m5x00 c=green; 7
8
Maps and Legends 8 Three parts – Set Appearance of Legend Across: Number of columns to use for legend entry Down: Number of rows to use for legend entry – Position the Legend Position=( ) Default is position =(bottom center outside) Mode= protect | reserve | share – Set Text Specifications for the Legend (e.g., font type, size, color)
9
Comparison of Legend Placement, Maps of CMS Regions Bottom, Center, Outside Top, Center, Outside 9
10
Adding Labels to Maps: Annotate Facility Create a file that contains the information to be used as labels Need to include in the file the following: 10 – Function – Text – Color – Style – Size – HSYS – X Coordinate – XSYS – Y Coordinate – YSYS – Position
11
Labeling Cities in Maryland 11 data citystar_md; length function color $ 8 position $ 1 text $ 20 style $ 30; retain xsys ysys '2' hsys '3' when 'a‘; set maps.uscity; if city in ("Baltimore","Columbia","Annapolis“,"Hagerstown“, "Rockville","Frederick") and state=24; /* Create the observation for a star */ function='symbol'; style='marker'; text='V‘; color='yellow'; size=1.5; position='5'; output; /* Create the observation for a city */ function='label'; style="'Arial/Bold'"; text=city; color='black'; size=4; position='2'; output; run;
12
Maryland County Population, 2010 (with cities labeled) 12
13
Positioning Labels 123 456 789 13 The position variable in an annotate data set tells SAS where to place the text relative to the X Y coordinates. Using a position of ‘5’ puts the text on the point itself, and ‘9’ would be to the lower right,
14
Creating Map Output Files Can create maps as GIF, JPEG, PNG – GIF file (device=gif) – JPEG file (device=jpeg – PNG file (device=png) Can use these files in HTML files Can also create PDF files using ODS – ods listing close; – ods pdf file=“K:\...” notoc; – proc gmap data=… 14
15
Create maps with different boundaries Use PROC GREMOVE in order to remove the internal boundaries Example: – File (called pdp) that has states assigned to PDP regions – Merge, on state, with SAS generated U.S. map – Sort merged file on PDP regions – Remove internal outlines from map 15
16
PDP Region Map 16
17
Create maps for HTML Requires use of ODS Can use the following drivers – Gif – Java – Activex – HTML Can create – pop ups – drill downs 17
18
Demonstration 18
19
Additional Resources www.colorbrewer.com www.robslink.com “The Basics of Map Creation with SAS/GRAPH®”, Mike Zdeb, http://www.albany.edu/~msz03/251-29.pdf http://www.albany.edu/~msz03/251-29.pdf “Tips and Tricks IV: More SAS/Graph Map Secrets.” SAS Global Forum 2009 paper and example source code download. SAS Institute Inc. http://support.sas.com/rnd/papers.http://support.sas.com/rnd/papers 19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.