Chapter Contents

Previous

Next
The GPROJECT Procedure

Example 4: Projecting an Annotate Data Set


Procedure features:
PROC GPROJECT options:
DATA=
OUT=
ID statement
Other features:
CHORO statement
Annotate data set
Data set: REFLIB.US48
Sample library member: GR23N04

[IMAGE]

This example illustrates how to project an Annotate data set for use with a map data set. It labels the locations of Miami, Boston, and Bangor on the map shown in the second example. Because the X and Y variables in the USCITY data set already have been projected to match the US data set, they cannot be used with the map that is produced by the second example. To properly label the projected map, the example uses the same projection method for the city coordinates as the method that is used for the map coordinates. This example illustrates how to use the same projection method for both data sets.
 Note about code
libname reflib 'SAS-data-library';
libname maps 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red)
         ftext=swiss htitle=6 htext=3;
 Note about code
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;
 Note about code
data all;
   set reflib.us48 cities;
run;
 Note about code
proc gproject data=all
              out=allp
              project=gnomon
              polelong=160
              polelat=45;
   id state;
run;
 Note about code
data citiesp us48p;
   set allp;
   if state>100 then output citiesp;
   else output us48p;
run;
 Note about code
title1 'Distribution Center Locations';
title2 'East Coast';
footnote j=r 'GR23N04 ';
 Note about code
pattern value=mempty repeat=49 color=blue;
 Note about code
proc gmap data=us48p map=us48p all;
   id state;
   choro state
         / nolegend
           annotate=citiesp;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.