Sample 25571: Projecting an annotate data set using PROC GPROJECT
This sample is from the "SAS/GRAPH Software: Reference, Version 9.1", Volume 2, Chapter 39.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GPJANNOT |
| TITLE: GPJANNOT-Projecting an Annotate Data Set |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS GOPTIONS GMAP GPROJECT MAPS PATTERN |
| PROCS: GMAP GPROJECT |
| DATA: EXTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
| MISC: EDIT AND UNCOMMENT THE LIBNAME STATEMENTS |
| IF THE LIBREFS HAVE NOT BEEN DEFINED. |
+-------------------------------------------------------------+*/
/* Define the libref maps */
*libname maps 'SAS-MAPS-library';
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(black blue green red)
ftext=swiss htitle=6 htext=3;
/* Create Annotate data set CITIES */
data cities(drop=state rename=(newst=state));
set maps.uscity(keep=lat long city state);
length function style color $ 8 position $ 1 text $ 20;
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='blue'; size=10; text='T'; position='5';
style='marker'; x=long*arcos(-1)/180;
y=lat*arcos(-1)/180; output;
newst+1; color='blue'; size=4; text=' '||city;
position='6'; style='swissb'; 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;
/* Define title and footnote for map */
title1 'Distribution Center Locations';
title2 'East Coast';
footnote j=r 'GPJANNOT ';
/* Define pattern characteristics */
pattern value=mempty repeat=49 color=blue;
/* Show the annotated map */
proc gmap data=us48p map=us48p all;
id state;
choro state / nolegend
annotate=citiesp;
run;
quit;

This example illustrates how to project an Annotate data set for use with a map data set.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GPROJECT SAS Reference ==> Procedures ==> GMAP
|
| Date Modified: | 2005-08-27 03:03:25 |
| Date Created: | 2005-05-23 14:16:18 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | 8 TS M0 | n/a |