The sample code on the Full Code tab uses PROC GPROJECT and PROC GMAP to project an Annotate data set for use with a map data set.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Define the libref of MAPS if necessary */
*libname maps 'location-of-map-datasets';
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create Annotate data set CITIES */
data cities(drop=state rename=(newst=state));
set maps.uscity(keep=lat long city state);
length function color $ 8 position $ 1 text $ 20 style $ 25;
retain function 'label' xsys ysys '2'
hsys '1' when 'b' newst 100;
if state=12 and city='Miami' or
state=25 and city='Boston' or
state=23 and city='Bangor';
newst+1; color='depk'; size=10; text='T'; position='5';
style='marker'; x=long*arcos(-1)/180;
y=lat*arcos(-1)/180; output;
newst+1; color='CX7C95CA'; size=4; text=' '||city;
position='6'; style="'Albany AMT/bold'"; output;
run;
/* Create reduced continental U.S. map data set */
/* and remove Alaska, Hawaii, and Puerto Rico */
data us48;
set maps.states;
if state ne 2 and state ne 15 and state ne 72;
if density<3;
run;
/* Create data set ALL by combining data set */
/* US48 and data set CITIES */
data all;
set us48 cities;
run;
/* Project the ALL data set */
proc gproject data=all
out=allp
project=gnomon
polelong=160
polelat=45;
id state;
run;
/* Separate the projected data set into */
/* the CITIESP Annotate data set and */
/* the US49P map data set */
data citiesp us48p;
set allp;
if state>100 then output citiesp;
else output us48p;
run;
/* Add titles to the map */
title1 'Distribution Center Locations';
title2 h=11pt 'East Coast';
footnote1 angle=90 ' ';
/* Define pattern characteristics */
pattern value=mempty repeat=49 color=black;
/* Create the annotated map */
proc gmap data=us48p map=us48p all;
id state;
choro state / nolegend
annotate=citiesp;
run;
quit;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Maps ==> Projecting SAS Reference ==> Procedures ==> GMAP |
Date Modified: | 2005-08-27 03:03:25 |
Date Created: | 2005-05-23 14:16:18 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9 TS M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9 TS M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9 TS M0 | |||
Microsoft Windows 2000 Advanced Server | 9 TS M0 | |||
Microsoft Windows 2000 Datacenter Server | 9 TS M0 | |||
Microsoft Windows 2000 Server | 9 TS M0 | |||
Microsoft Windows 2000 Professional | 9 TS M0 | |||
Microsoft Windows NT Workstation | 9 TS M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9 TS M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9 TS M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9 TS M0 | |||
Microsoft Windows XP Professional | 9 TS M0 | |||
64-bit Enabled AIX | 9 TS M0 | |||
64-bit Enabled HP-UX | 9 TS M0 | |||
64-bit Enabled Solaris | 9 TS M0 | |||
HP-UX IPF | 9 TS M0 | |||
Linux | 9 TS M0 | |||
OpenVMS Alpha | 9 TS M0 | |||
Tru64 UNIX | 9 TS M0 |