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


goptions ftext=swiss gunit=pct htext=2 rotate=landscape;   
                                                           
   /* Input information for each model.  Variables       */
   /* include:                                           */
   /*                                                    */
   /*   SHARE -- percentage of vehicles of that model    */
   /*            in lot                                  */
   /*   RATING -- rating on "sportiness" scale (0-10)    */
   /*   PRICE -- list price (in 1000's of dollars)       */
data autos;                                                
   input manufact $char9. model $ share rating price;      

   cards;                                                  
Mazda     Miata      .10  9.3 15.2                         
Chevrolet S-10       .10  2.5 14.4                         
Infiniti  M30        .075 7.2 24.3                         
Ford      Taurus     .10  4.3 13.3                         
Plymouth  Voyager    .20  1.6 12.5                         
Toyota    Cressida   .15  6.0 23.1                         
Honda     Civic      .10  3.7  7.0                         
Acura     Integra    .175 6.5 12.1                          
;                                                           
                                                            
   /* Create an Annotate data set to label categories on */ 
   /* axes and draw labels inside bubbles.               */ 
data anno;                                                  
   length style $ 8 text $ 17;                              
                                                            
      /* First create axis category labels using the     */ 
      /* SWISSBI font.  XSYS, YSYS and HSYS specify the  */ 
      /* units used when determining the location and    */ 
      /* size of text--in this case percentage of the    */ 
      /* procedure output area.  POSITION is used to     */ 
      /* justify the text as appropriate.                */ 
   style='swissbi'; size=5;                                 
   xsys='5'; ysys='5'; hsys='5';                            
   function='label'; when='a'; color='black';               
   if _n_=1 then do;                                        
      position='6';                /* Left-align text    */ 
      x=2;  y=10; text='Economical and'; /* Lower left   */ 
            output;                                         
            y=5;  text='Practical';  output;                
            y=98; text='Economical and'; /* Upper left   */ 
            output;                                         
            y=93; text='Sporty'; output;                    
      position='4';                /* Right-align text   */ 
      x=98; y=10; text='Expensive and'; /* Lower right   */ 
            output;                                         
            y=5;  text='Practical';  output;
            y=98; text='Expensive and'; /* Upper right   */  
            output;                                          
            y=93; text='Sporty'; output;                     
      end;                                                   
                                                             
      /* Use the information from the AUTOS data set to  */  
      /* annotate labels inside bubbles.  XSYS and YSYS  */  
      /* specify that X and Y correspond to locations    */  
      /* on the horizontal and vertical axes. The values */  
      /* of MANUFACT and MODEL from the AUTOS data set   */  
      /* are used for text.The POSITION values cause the */  
      /* manufacturer name to be placed slightly above   */  
      /* the center of the bubble and the model name to  */  
      /* be placed below it.                             */  
   set autos;                                                
   xsys='2'; ysys='2';                                       
     style='swiss'; size=2.5;                                
     x=price; y=rating;                                      
     text=manufact; position='b'; output;                    
     text=model; position='e';    output;                    
 run;                                                        
                                                             
   /* Add titles and footnotes.                          */  
title h=5 f=swissb 'Parking Lot Survey';                     
title2 h=5 f=swissb 'of Selected Automobiles';               
title3 ' ';                                                  
footnote h=2                                                 
         'Bubble size represents percentage of '             
         'vehicles of that model in parking lot';                            

footnote2 h=2 j=l                                           
          'SAS/GRAPH' m=(+0,+.5) '02'x m=(+0,-.5)           
          ' software';                                      
                                                            
  /* Set up axis specifications.  The ORDER= option      */ 
  /* extends the axes beyond the range of data so that   */ 
  /* bubbles are not clipped.  The ORIGIN= option is     */ 
  /* used to adjust the origin of the axes to make room  */ 
  /* for annotation.  The LENGTH option is used to       */ 
  /* offset the right end of the horizontal axis from    */ 
  /* the graph edge, centering the plot.  Note that even */ 
  /* though the axes are not actually drawn (because the */ 
  /* NOAXES option is specified later), their attributes */ 
  /* affect the rest of the graph.                       */ 
axis1 order=(5 to 25 by 10) origin=( ,18) length=85 pct;    
axis2 order=(0 to 10 by 2) origin=(7.5);                    
                                                            
   /* Use the PROC GPLOT BUBBLE statement to produce the */ 
   /* plot. The NOAXES option causes the axes not to be  */ 
   /* drawn, and the HREF and VREF options draw the      */ 
   /* 'crosshairs' in the middle of the plot.            */ 
proc gplot data=autos annotate=anno;                        
   bubble rating*price=share/                               
      haxis=axis1    /* Assign AXIS attributes to axes.  */ 
      vaxis=axis2                                           
      noaxes         /* Suppress drawing of axes.        */ 
      href=15        /* Ref. line at middle of           */ 
                     /* horizontal axis                  */ 
      chref=graycc   /* Color of reference line          */ 
      vref=5         /* Ref. line at middle of vertical
                     /* axis                             */
      cvref=graycc   /* Color of reference line          */
      bsize=14       /* Scaling factor for bubble size   */
      blabel         /* Print percentage next to bubble. */
      bfont=swiss;   /* Font for percentage label        */
                                                           
   /* Use the PERCENT5.1 format to display the values of */
   /* SHARE as percentages.                              */
format share percent5.1;                                   
run;


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


goptions nodisplay device=ps;


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


goptions display device='
                         /* drivername */
                                         ';

proc greplay nofs igout=gseg;                 
   replay _last_;                             


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


proc format;                    
   picture percent              
      0-100='00.0%' (mult=1000);
run;                            
                                                            

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