/**********************************************************************/


   /* Pipe type, location (latitude & longitude), and      */                                                                          
   /* county FIPS code are in PDATA                        */                                                                           
libname mylib '
               /* SAS-data-library */
                                     ';                                                                                            
data mylib.mapsym;                                                                                                                
   set mylibdata;  


/**********************************************************************/


x=-lon*3.14165927/180;                                                                                                               
y=lat*3.14165927/180;   


/**********************************************************************/


      /* XSYS & YSYS=2 specify to evaluate X & Y           */                                                                            
      /* as data values.                                   */                                                                            
      /* Center of symbol drawn at coordinate              */                                                                            
      /* position.                                         */                                                                            
      /* Specifies that symbols are drawn after the        */                                                                            
      /* map is drawn.                                     */                                                                            
   retain function 'label'                                                                                                        
          color 'black'                                                                                                           
          xsys ysys '2'                                                                                                           
          position '5'                                                                                                            
          when 'a';   


/**********************************************************************/


   style='special';                                                                                                               
   if pipetype=1      then text='A';  /* Concave square    */                                                                        
   else if pipetype=2 then text='E';  /* Club              */                                                                          
   else if pipetype=3 then text='D';  /* Diamond           */                                                                          
   else if pipetype=4 then text='H';  /* Open circle       */                                                                          
   else if pipetype=5 then text='I';  /* Star              */                                                                          
   else if pipetype=6 then text='C';  /* Heart             */                                                                          
   else if pipetype=7 then text='B';  /* Spade             */ 


/**********************************************************************/


   /* This program will prepare a data set to be           */                                                                           
   /* used as the Annotate source data. It contains        */                                                                           
   /* information needed to place the symbols              */                                                                           
   /* identifying the locations and types of pipes         */                                                                           
   /* to be shown on the map. The data set named           */                                                                           
   /* MAPSYM will become the input data set for            */                                                                           
   /* drawing a map of interest.                           */                                                                           
                                                                                                                                     
   /* pipe type, location (latitude & longitude) and       */                                                                           
   /* county FIPS code are in mylibdata                    */                                                                           
libname mylib '
               /* SAS-data-library */
                                     ';  
data mylib.mapsym;                                                                                                                
   set mylibdata;                                                                                                                 
                                                                                                                                   
      /* STEP1:  Convert latitude and longitude to         */                                                                          
      /*         conventional SAS form.                    */                                                                          
                                                                                                                                  
      /*  Original data are in decimal degrees with        */                                                                          
      /*  west longitude negative. SAS form is             */                                                                          
      /*  latitude and longitude in radians with           */                                                                          
      /*  west longitude positive. Y is SAS latitude,      */                                                                          
      /*  X is SAS longitude.                              */                                                                          
   x=-lon*3.14165927/180;                                                                                                         
   y= lat*3.14165927/180;                                                                                                         
                                                                                                                                    
      /* STEP 2:  Assign annotate variables common to      */                                                                          
      /*          all points.                              */                                                                          
      /* See SAS/GRAPH Software: Reference, Vol.1, p 472.  */                                                                          
                                                                                                                                     
      /* XSYS & YSYS=2 specify to evaluate X & Y as        */                                                                          
      /* data values.                                      */                                                                          
      /* Center of symbol drawn at coordinate              */                                                                          
      /* position.                                         */                                                                          
      /* Specifies that symbols are drawn after the        */                                                                          
      /* map is drawn.                                     */                                                                          
   retain function 'label'                                                                                                        
          color 'black'                                                                                                           
          xsys ysys '2'                                                                                                           
          position '5'                                                                                                            
          when 'a';                                                                                                               
                                                                                                                                     
      /* STEP 3:  Select symbols for each pipe type.       */                                                                        
                                                                                                                                  
   style='special';  /* Selects special character font,    */                                                                        
                     /* SAS/GRAPH Software: Reference,     */                                                                        
                     /* Vol.1, p.174                       */                                                                        
                                                                                                                                    
   if pipetype=1      then text='A';  /* Concave square    */                                                                        
   else if pipetype=2 then text='E';  /* Club              */                                                                          
   else if pipetype=3 then text='D';  /* Diamond           */                                                                          
   else if pipetype=4 then text='H';  /* Open circle       */                                                                          
   else if pipetype=5 then text='I';  /* Star              */                                                                          
   else if pipetype=6 then text='C';  /* Heart             */                                                                          
   else if pipetype=7 then text='B';  /* Spade             */                                                                          
                                                                                                                                     
      /* STEP 4:  Assign a data-separation value to all    */                                                                        
      /* observations. When using the GPROJECT procedure   */                                                                       
      /* in the mapping routine, the Annotate data and     */                                                                        
      /* the state map coordinates are to be combined      */                                                                        
      /* for projection and separated again for            */                                                                        
      /* annotation.  The state coordinate data have a     */                                                                        
      /* state FIPS variable (NC=37). By including a       */                                                                        
      /* STATE variable in the Annotate data set, these    */                                                                        
      /* data may be separated from map coordinate data    */                                                                        
      /* after projection with PROC GPROJECT.              */                                                                        
   state=999;                                                                                                                     
run;     


/**********************************************************************/


libname mylib '
               /* SAS-data-library */
                                     ';  
                                                                                                                                     
   /* pipe location and type data (including symbol data)  */                                                                         
   /* are in MYLIB.MAPSYM                                  */                                                                         
                                                                                                                                     
   /* STEP1:  select subset of pipes                       */                                                                                           
%let ptype=1 2 3 4 5 6 7; /* CHOOSE PIPE TYPES HERE        */                                                                      
%let reg=1 2 3;           /* CHOOSE REGION HERE            */                                                                           
                          /* 1=west 2=central 3=east       */                                                                           
                                                                                                                                     
   /* title of map                                         */                                                                                                             
title c=black f=centx 'All pipes in Data Set';                                                                                    
data set1;                                                                                                                        
   set mylib.mapsym;                                                                                                              
   if pipetype in(&ptype);                                                                                                        
                                                                                                                                    
      /* Assign pipe locations to regions:                 */                                                                           
      /* 1=west of I-77, 2=central, 3=east of I-95.        */                                                                           
   if lat-5.407*lon > 472.45 then region=1;                                                                                       
   else if lat-1.168*lon < 127.09 then region=3;                                                                                  
   else region=2;                                                                                                                 
   if region in(®);                                                                                                            
run;                                         


/**********************************************************************/


data mapmk;                                                                                                                       
   set maps.county(where=(state=37)) set1;                                                                                        
run;      


/**********************************************************************/


proc gproject data=mapmk out=both;                                                                                                
   id county;  /* county FIPS variable is common to        */                                                                           
               /* both data sets.                          */                                                                           
run;   


/**********************************************************************/


data ncproj symproj;                                                                                                              
   set both;                                                                                                                      
   if state=999 then output symproj; /* Projected          */                                                                        
                                     /* Annotate data      */                                                                        
                                                                                                                                  
                else output ncproj;  /* Projected          */                                                                        
                                        county map data    */                                                                        
run;          


/**********************************************************************/


pattern1 c=black v=e;                                                                                                             
   footnote1 c=black                                                                                                                 
             f=special 'A' f=centx '  Pipe type 1'                                                                                   
             f=special '      E' f=centx '  Pipe type 2'                                                                             
             f=special '      D' f=centx '  Pipe type 3';                                                                            
   footnote2 c=black                                                                                                                 
             f=special 'H' f=centx '  Pipe type 4'                                                                                   
             f=special '      I' f=centx '  Pipe type 5'                                                                             
             f=special '      C' f=centx '  Pipe type 6';                                                                            
   footnote3 c=black                                                                                                                 
             f=special 'B' f=centx '  Pipe type 7';                                                                                  
                                                                                                                                   
proc gmap data=ncproj map=ncproj;                                                                                                 
   id county;                                                                                                                     
   choro county / nolegend                                                                                                        
                  levels=1                                                                                                        
                  annotate=symproj; /* Note Annotate       */                                                                           
                                    /* data set is         */                                                                           
                                    /* SYMPROJ.            */                                                                           
run;                                                                                                                              
quit;                           


/**********************************************************************/


   /*  This program will prepare a map of selected         */                                                                          
   /*  points obtained from the previously prepared        */                                                                          
   /*  MYLIB.MAPSYM data set.                              */                                                                          
                                                                                                                                     
   /* pipe location and type data (including Annotate      */                                                                          
   /* data) are in MYLIB.MAPSYM                            */                                                                          
libname mylib '
               /* SAS-data-library */
                                     ';  
                                                                                                                                                                   
   /* STEP1:  select subset of pipes                       */                                                                          
%let ptype=1 2 3 4 5 6 7; /* CHOOSE PIPETYPES HERE         */                                                                        
%let reg=1 2 3;           /* CHOOSE REGION HERE            */                                                                          
                          /* 1=west 2=central 3=east       */                                                                          
                                                                                                                                     
   /* title of map                                         */                                                                          
title c=black f=centx 'All pipes in Data Set';                                                                                    
                                                                                                                                     
data set1;                                                                                                                        
   set mylib.mapsym;                                                                                                              
   if pipetype in(&ptype);                                                                                                        
                                                                                                                                     
      /* Assign pipe locations to regions:                 */
      /* 1=west of I-77, 2=central, 3=east of I-95.        */                                                                          
   if lat-5.407*lon > 472.45 then region=1;                                                                                       
   else if lat-1.168*lon < 127.09 then region=3;                                                                                  
   else region=2;                                                                                                                 
   if region in(®);                                                                                                            
run;                                                                                                                              
                                                                                                                                     
   /* STEP2: Combine map coordinates &                     */                                                                          
   /*        Annotate data set.                            */                                                                          
data mapmk;                                                                                                                       
   set maps.county(where=(state=37)) set1;                                                                                        
run;                                                                                                                              
                                                                                                                                     
   /* STEP3:  project both                                 */                                                                                                     
proc gproject data=mapmk out=both;                                                                                                
   id county;   /* county FIPS variable is common          */                                                                          
                /* to both sets.                           */                                                                          
run;                                                                                                                              
                                                                                                                                     
   /* STEP4:  separate projected data                      */                                                                          
                                                                                                                                   
data ncproj symproj;                                                                                                              
   set both;                                                                                                                      
   if state=999 then output symproj; /* Projected          */                                                                          
                                     /* Annotate data      */                                                                          
                                                                                                                                     
                else output ncproj;  /* Projected          */                                                                       
                                     /* county map data    */                                                                        
run;                                                                                                                              
                                                                                                                                     
   /* STEP5:  make map w/ points annotated                 */                                                                                     
pattern1 c=black v=e;                                                                                                             
                                                                                                                                     
   footnote1 c=black                                                                                                                 
             f=special 'A' f=centx '  Pipe type 1'                                                                                   
             f=special '      E' f=centx '  Pipe type 2'                                                                             
             f=special '      D' f=centx '  Pipe type 3';                                                                            
   footnote2 c=black                                                                                                                 
             f=special 'H' f=centx '  Pipe type 4'                                                                                   
             f=special '      I' f=centx '  Pipe type 5'                                                                             
             f=special '      C' f=centx '  Pipe type 6';                                                                            
   footnote3 c=black                                                                                                                 
             f=special 'B' f=centx '  Pipe type 7';                                                                                  
                                                                                                                                     
                                                                                                                                     
proc gmap data=ncproj map=ncproj;                                                                                                 
   id county;                                                                                                                     
   choro county / nolegend                                                                                                        
                  levels=1                                                                                                        
                  annotate=symproj;  /* Note Annotate      */                                                                          
                                     /* data set is        */                                                                          
                                     /* SYMPROJ.           */                                                                          
run;                                                                                                                              
quit;                   


/**********************************************************************/


libname mylib '
               /* SAS-data-library */
                                     ';  

   /* more program lines */
                              
   %let ptype=2 3 4;      /* CHOOSE PIPE TYPES HERE        */                                                                            
   %let reg=2;            /* CHOOSE REGION HERE            */                                                                              
                          /* 1=west 2=central 3=east       */                                                                              
                                                                                                                                     
      /* title of map                                      */                                                                                                             
   title c=black f=simplex                                                                                                           
         'Pipes of Types 2, 3 & 4 in Central Region';                                                                                

   /* more program lines */

   run;            


/**********************************************************************/


libname mylib '
               /* SAS-data-library */
                                     ';  

   /* more program lines */
                               
   %let ptype=2 4 5;      /* CHOOSE PIPE TYPES HERE        */                                                                         
   %let reg=3;            /* CHOOSE REGION HERE            */                                                                             
                             1=west 2=central 3=east       */                                                                             
                                                                                                                                     
      /* title of map                                      */                                                                                                             
   title c=black f=simplex                                                                                                           
         'Pipes of Types 2, 4 & 5 in East Region';                                                                                   

   /* more program lines */
 
   run;                


/**********************************************************************/