These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The graphics output in the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Set the graphics environment */
goptions reset=all cback=grayd0 border htitle=12pt htext=10pt;
/* Create input data set, AUTODATA. AUTODATA contains the */
/* results of an informal local survey of selected autos. */
/* SHARE is the percent of total autos surveyed. RATING */
/* indicates practicality vs. sportiness on a 1 to 10 scale. */
/* PRICE is the cost in thousands of dollars. */
data autodata;
input auto $ 17. share rating price;
datalines;
Mazda Miata .10 9.4 15.2
Chevy S-10 .10 2.9 14.0
Infiniti M30 .075 7.2 24.3
Ford Taurus .10 4.3 13.3
Plymouth Voyager .20 1.8 13.2
Toyota Cressida .15 6.0 23.7
Honda Civic .10 3.7 7.0
Acura Integra .175 6.5 12.1
;
run;
/* Create the annotate data set, LABELS. LABELS adds text to */
/* the quadrants and labels the bubbles with the make of auto */
/* represented. Because the value of WHEN is 'A' (after), the */
/* Annotate facility draws the text after the plot is drawn. */
data labels;
length function color $8 style $22 text $17;
retain function 'label' hsys '3' when 'a';
if _n_=1 then do;
/* The labels are positioned using the absolute percent */
/* of the data area, the coordinate system 1. */
xsys='1'; ysys='1'; size=3.5;
color='blue'; style="Albany AMT/bold/italic";
/* Vertical position for labels across the top of the plot. */
y=96;
x=1; position='C'; text='Economical and'; output;
position='F'; text='Sporty'; output;
x=50; position='B'; output; /* The value of TEXT remains 'Sporty'. */
x=99; position='A'; text='Expensive and'; output;
position='D'; text='Sporty'; output;
/* Vertical position for the two vertical reference line labels. */
y=50;
x=1; position='F'; text='Economical'; output;
x=99; position='D'; text='Expensive'; output;
/* Vertical position for labels across the bottom of the plot. */
y=6;
x=1; position='C';text='Economical and'; output;
position='F'; text='Practical'; output;
x=50; position='E'; output; /* The value of TEXT remains 'Practical'. */
x=99; position='A'; text='Expensive and'; output;
position='D'; text='Practical'; output;
end;
/* Values from AUTODATA provide the text and position of the bubble */
/* labels. Since the values of plot variables position the bubble */
/* labels, the coordinate system is absolute data values (2). */
set autodata;
drop share rating price auto;
text=auto; x=price; y=rating; xsys='2'; ysys='2'; position='5';
style="Albany AMT/bold"; size=3; color='black'; output;
run;
/* Define the title and footnote */
title1 'Market Analysis of Selected Automobiles';
footnote1 ls=1
'Bubble size and labels represent the market share, in percent, of autos in this survey.';
/* Create axis definitions */
axis1 order=(5 to 27) label=none value=none
major=none minor=none;
/* OFFSET= offsets the ends of the vertical axis to prevent */
/* a collision between the bubbles and the axis frame. */
/* Other options suppress labels and tick marks. */
axis2 order=(0 to 10) offset=(2,2) value=none label=none
major=none minor=none ;
/* Produce the bubble plot */
proc gplot data=autodata;
bubble rating*price=share / bsize=12 bcolor=salmon
bfill=solid blabel
ctext=black cframe=white
haxis=axis1 vaxis=axis2
href=16 chref=blue lhref=2
vref=5 cvref=blue lvref=2
annotate=labels;
format share percent7.1;
run;
quit;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GPLOT Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Plots ==> Bubble |
Date Modified: | 2011-03-11 11:01:46 |
Date Created: | 2004-11-11 11:08:02 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |||
Microsoft® Windows® for x64 | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |||
Microsoft Windows XP Professional | 9.2 TS1M0 | |||
Windows Vista | 9.2 TS1M0 | |||
Windows Vista for x64 | 9.2 TS1M0 | |||
64-bit Enabled AIX | 9.2 TS1M0 | |||
64-bit Enabled HP-UX | 9.2 TS1M0 | |||
64-bit Enabled Solaris | 9.2 TS1M0 | |||
HP-UX IPF | 9.2 TS1M0 | |||
Linux | 9.2 TS1M0 | |||
Linux for x64 | 9.2 TS1M0 | |||
OpenVMS on HP Integrity | 9.2 TS1M0 | |||
Solaris for x64 | 9.2 TS1M0 |