%let name=shoe_sales;
filename odsout '.';

data my_data;
input brand $ 1-20 units_sold average_price;
size_var=units_sold*average_price;
length my_html $300;
my_html='title='||quote(
 trim(left(brand))||'0d'x||
 'Units Sold: '||trim(left(put(units_sold,comma8.0)))||'0d'x||
 'Avg. Price: '||trim(left(put(average_price,dollar8.2)))
 );
datalines;
Reebok               22000 32.00
Lotto                8500 43.00
Woodland             12500 44.00
Puma                 19500 50.00
Adidas               19000 59.50
Fila                 10500 64.00
Nike                 15000 80.00
;
run;

data anno_labels; set my_data;
length test $100;
xsys='2'; ysys='2'; hsys='d'; when='a'; 
x=average_price; y=units_sold;
function='label'; position='5'; size=8;
text=trim(left(brand));
run;

%let gavg=44.00; /* gross average price */

data anno_lines;
length function $8 color $8 text $100;
xsys='2'; ysys='2'; hsys='3'; when='b'; 
x=0; y=15000; function='move'; output;
x=100; y=15000; function='draw'; size=1.0; color='gray77'; output;
x=50; y=0; function='move'; output;
x=50; y=30000; function='draw'; size=1.0; color='gray77'; output;
x=&gavg; y=0; function='move'; output;
x=&gavg; y=30000; function='draw'; size=0.1; line=3; color='blue'; output;
function='label'; size=.;
x=&gavg; y=30000; position='2'; color='blue'; text='Gross Avg.'; output;
xsys='1'; ysys='1'; color='';
x=1; y=0; position='3'; text='Low Price / Low Sales'; output;
x=1; y=100; position='f'; text='Low Price / High Sales'; output;
x=99; y=0; position='1'; text='High Price / Low Sales'; output;
x=99; y=100; position='d'; text='High Price / High Sales'; output;
run;


goptions device=png;
goptions xpixels=700 ypixels=400;
goptions noborder;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" 
 (title="Shoe Sales") style=htmlblue;

goptions gunit=pct ftitle='albany amt/bold' ftext='albany amt' htitle=15pt htext=10pt ctext=gray33;

axis1 label=(a=90 'Units Sold') order=(0 to 30000 by 10000) 
 major=none minor=none offset=(0,0);

axis2 label=('Average Price') order=(0 to 100 by 20) 
 major=none minor=none offset=(0,0);

symbol1 value=dot interpol=none color=blue
 pointlabel=(height=9pt color=gray77 nodropcollisions position=middle justify=center "#brand");

title1 ls=1.5 "Sales Analysis of Shoe Brands" font='albany amt' " (Last Quarter)";
title2 ls=0.8 " ";

proc gplot data=my_data anno=anno_labels;
format units_sold comma8.0;
format average_price dollar5.0;
bubble units_sold*average_price=size_var / 
 bsize=15 bfill=solid bscale=area
 bcolor=A4dc6eccc
 vaxis=axis1 haxix=axis2 noframe
 anno=anno_lines
 autohref chref=gray77 lhref=33
 autovref cvref=gray77 lvref=33
 html=my_html
 des='' name="&name";
run;


quit;
ODS HTML CLOSE;
ODS LISTING;
