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


goptions reset=all ftext=swissb htext=3 rotate=landscape;
                                                         
data states;                                                
   set maps.states;                                         
                                                            
      /* not all boundary detail needed  */                 
   if density<=2;                                           
                                                            
      /* select South Atlantic                            */
   if state in (12,13,37,45);                               
                                                            
      /* convert STATE value to hex to use                */
      /* for CHAR variable                                */
   char=input(put(state,hex2.),$hex2.);                     
                                                            
      /* state outlines are polygons                      */
   lp='p';                                                  
                                                            
      /* reverse image of states                          */
   x=-x;                                                    
run; 


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


proc sort; 
   by char;
run;

proc means data=states noprint mean;          
   var y x;                                   
   by char;                                   
   output out=mean min=ymin xmin max=ymax xmax
          mean=ymean xmean;                   
run;


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


data states2;        
   merge states mean;
   by char;          
   scale=max(ymax-ymin,((xmax-xmin)*.50));
   y=(y-ymean)/(scale);                   
   x=(x-xmean)/(scale);                   
run;


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


libname gfont0 '\ob your-font-library\obe ';         
proc gfont data=states2 filled name=stfont nodisplay;
run;                                                 


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

data farms;                      
   input stcode $ farms @@;      
   number=round((farms/10000),1);
   do num=1 to number;             
      output;                      
   end;                            
   cards;                          
FL 41000 GA 48000 NC 64000 SC 25000
;                                  


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


proc sort data=farms;
   by number stcode; 
run;                 


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

data farms;                                                  
   set farms end=eof;                                        
   by number stcode;                                         
                                                             
      /* hex value of state code                          */ 
   shex=put(stfips(stcode),$hex2.);                          
   if first.stcode then do;                                  
                                                             
         /* count number of states                        */ 
      nstates+1;                                             
      call symput('state'||left(nstates),trim(stcode));      
      call symput('scode'||left(nstates),trim(shex));        
   end;                                                      
   if eof then do;                                           
                                                             
         /* total number of states                        */ 
      call symput('total',nstates);                          
                                                            
         /* total number of symbols                       */
      call symput('nsyms',num);                             
                                                            
         /* number of reference lines                     */
      call symput('maxref',num-1);                          
   end;                                                     
run;                                                        


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


%macro order;         
   %do i=1 %to &total;
      "&&state&i"     
   %end;              
%mend;                


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


%macro symbols;                                             
   %do i = 1 %to &total;                                    
      symbol&i font=stfont h=6                              
               value="&&scode&i"x interpol=none color=black;
   %end;                                                    
%mend;                                                      
                                                            
%symbols                   /* generate SYMBOL statements  */


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


title h=8 pct 'NUMBER OF FARMS';                 
title2 h=8 pct 'SOUTH ATLANTIC U. S.';           
footnote h=2 '1 SYMBOL = 10,000 FARMS (ROUNDED)';
footnote2 j=l h=1.5 'SAS/GRAPH' m=(+0,+.5)       
          '02'x m=(+0,-.5) ' Software';          
                                                            
proc gplot data=farms;                                      
   plot stcode*num=nstates                                  
        / nolegend                                          
        vaxis=axis1                                         
        haxis=axis2                                         
                                                            
           /* draw vertical ref lines                     */
        href=1.5 to &maxref..5                              
                                                            
           /* dashed reference lines                      */
        lhref=2                                             
                                                            
           /* frame around plot area                      */
        frame                                               
                                                            
           /* light gray frame background                 */
        cframe=graydd;                                      
   axis1 order=%order label=none offset=(3,3) width=5       
         major=none minor=none;                             
   axis2 order=1 to &nsyms by 1 label=none major=none       
         minor=none value=none offset=(8,8);                
run;                                                        
quit;


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


axis1 order="SC" "FL" "GA" "NC" label=none offset=(3,3) 
      width=5 major=none minor=none;                    
                                                        
axis2 order=1 to 6 by 1 label=none major=none minor=none
      value=none offset=(8,8);


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


symbol1 font=stfont h=6 value='0C'x interpol=none
        color=black;                             
symbol2 font=stfont h=6 value='0D'x interpol=none
        color=black;                             
symbol3 font=stfont h=6 value='25'x interpol=none
        color=black;                             
symbol4 font=stfont h=6 value='2D'x interpol=none
        color=black;                             


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