Sample 56332: Annotate points on a U.S. map using the MAPSGFK.US_STATES data set
The sample code on the Full Code tab illustrates how to use an annotate data set to place points on a map using the MAPSGFK.US_STATES map data set. The PARMIN and PARMENTRY options are used in the PROC GPROJECT statement to project the annotate data set to match the MAPSGFK.US_STATES 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 sample code below illustrates how to use an annotate data set to place points on a map using the MAPSGFK.US_STATES map data set. The PARMIN and PARMENTRY options are used in the PROC GPROJECT statement to project the annotate data set to match the MAPSGFK.US_STATES data set.
/* Create a data set containing city names and locations */
data cities;
length city $20;
input y x city $;
state=37;
datalines;
35.783411 -78.79892 Cary
36.0789 -79.826888 Greensboro
35.19755 -80.834514 Charlotte
;
run;
/* Create an annotate data set to label */
/* the city locations with the city names */
data cname;
/* Get the X and Y values from the CITIES data set */
set cities;
/* Define the lengths of some of the variables */
length function style color $8 text $25;
/* Set the coordinate system to actual data values. */
/* Specify annotation to be applied after procedure output. */
retain xsys ysys '2' when 'a' size 1.5;
function='label';
color='black';
text=city;
position='2';
style="Arial";
output;
style='special';
text='M';
position='5';
output;
run;
/* Project the annotate data set to match */
/* the MAPSGFK.US_STATE map data set */
proc gproject data=cname out=anno dupok
parmin=mapsgfk.projparm parmentry=us_states;
id state;
run;
/* Create a map data set for NC */
data state;
set mapsgfk.us_states;
where state=37;
run;
title1 h=2 'Place points on a map at city locations';
title2 h=2 'using the MAPSGFK.US_STATES data set';
data sample;
state=37;
value=10;
run;
goptions border;
/* Generate a map of NC with city names */
proc gmap data=sample map=state;
id state;
choro state / discrete annotate=anno nolegend;
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.
This sample shows how you can annotate points on a map when using the MAPSGFK.US_STATES data set.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GMAP Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation
|
Date Modified: | 2015-08-17 16:15:55 |
Date Created: | 2015-08-03 09:54:14 |
Operating System and Release Information
SAS System | SAS/GRAPH | Solaris for x64 | 9.3 TS1M2 | |
Linux for x64 | 9.3 TS1M2 | |
Linux | 9.3 TS1M2 | |
HP-UX IPF | 9.3 TS1M2 | |
64-bit Enabled Solaris | 9.3 TS1M2 | |
64-bit Enabled HP-UX | 9.3 TS1M2 | |
64-bit Enabled AIX | 9.3 TS1M2 | |
Windows Vista for x64 | 9.3 TS1M2 | |
Windows Vista | 9.3 TS1M2 | |
Windows 7 Ultimate x64 | 9.3 TS1M2 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M2 | |
Windows 7 Professional x64 | 9.3 TS1M2 | |
Windows 7 Professional 32 bit | 9.3 TS1M2 | |
Windows 7 Home Premium x64 | 9.3 TS1M2 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M2 | |
Windows 7 Enterprise x64 | 9.3 TS1M2 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M2 | |
Microsoft Windows XP Professional | 9.3 TS1M2 | |
Microsoft Windows Server 2012 Std | 9.3 TS1M2 | |
Microsoft Windows Server 2012 R2 Std | 9.3 TS1M2 | |
Microsoft Windows Server 2012 R2 Datacenter | 9.3 TS1M2 | |
Microsoft Windows Server 2012 Datacenter | 9.3 TS1M2 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M2 | |
Microsoft Windows Server 2008 R2 | 9.3 TS1M2 | |
Microsoft Windows Server 2008 | 9.3 TS1M2 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M2 | |
Microsoft Windows 8.1 Pro 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8.1 Pro | 9.3 TS1M2 | |
Microsoft Windows 8.1 Enterprise x64 | 9.3 TS1M2 | |
Microsoft Windows 8.1 Enterprise 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8 Pro x64 | 9.3 TS1M2 | |
Microsoft Windows 8 Pro 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8 Enterprise x64 | 9.3 TS1M2 | |
Microsoft Windows 8 Enterprise 32-bit | 9.3 TS1M2 | |
Microsoft® Windows® for x64 | 9.3 TS1M2 | |
z/OS | 9.3 TS1M2 | |