%let name=musikasa; filename odsout '.'; /* SAS/Graph imitation of ... http://demos4.dundas.com/Musikasa/ */ GOPTIONS DEVICE=png; goptions gunit=pct htitle=6.5 ftitle="arial/bold" htext=5.1 ftext="arial" ctext=gray44; goptions nodisplay; /* gray background behind each of the 5 graphs */ data back1; length function $8 style $15 color $8; xsys='3'; ysys='3'; hsys='3'; when='b'; function='move'; x=0; y=0; output; function='bar'; line=0; style='solid'; color='cxe6ebf0'; x=100; y=100; output; function='move'; x=0; y=0; output; function='bar'; line=0; style='empty'; color='gray33'; x=100; y=100; output; run; /* gray background behind the whole page */ data back2; length function $8 style $15 color $8; xsys='3'; ysys='3'; hsys='3'; when='b'; function='move'; x=0; y=0; output; function='bar'; line=0; style='solid'; color='cxf5f8fa'; x=100; y=100; output; when='a'; function='move'; x=0; y=0; output; function='bar'; line=0; style='empty'; color='gray88'; x=100; y=100; output; run; title " "; /* graph 1 */ goptions xpixels=535 ypixels=248.5; data graph1; label val2009='2009'; label val2008='2008'; label val2007='2007'; input date date9. val2009 val2008 val2007; datalines; 01jan2009 1524 1324 1223 15jan2009 1542 1332 1235 01feb2009 1649 1436 1336 15feb2009 1737 1453 1351 01mar2009 1860 1558 1357 15mar2009 1820 1521 1426 01apr2009 1704 1502 1402 15apr2009 1808 1507 1418 01may2009 1949 1643 1553 15may2009 1992 1816 1722 01jun2009 2034 1844 1746 15jun2009 2358 1790 1731 01jul2009 2430 1862 1558 15jul2009 1971 1777 1585 01aug2009 2092 1964 1764 15aug2009 2361 1959 1767 01sep2009 1954 1854 1654 15sep2009 1981 1757 1558 01oct2009 2158 1947 1762 15oct2009 2311 2115 2014 01nov2009 2474 2204 2003 15nov2009 2668 2469 1971 01dec2009 2747 2447 2360 15dec2009 2743 2410 2430 01jan2010 2808 2531 2588 run; proc transpose data=graph1 out=graph1; by date; run; data graph1; set graph1; length my_html $200; my_html= 'title='||quote(substr(trim(left(put(date,date7.))),1,5)||': '||put(col1,dollar10.0)) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; length my_html2 $200; my_html2= 'title='||quote(trim(left(_label_))) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; run; /* annotate the 'green bar' background */ data greenbar; length function $8 style $15 color $15; xsys='1'; ysys='1'; hsys='3'; when='b'; do i = 0 to (100-(100/12)) by (100/12); counter+1; even_odd=mod(counter,2); x=i; y=0; function='move'; output; x=i+(100/12); y=100; function='bar'; style='solid'; line=0; if even_odd=1 then color='cxdfe1e2'; else color='cxfcfdfd'; output; end; run; axis1 c=gray44 label=none order=(1000 to 3000 by 500) minor=none offset=(0,0); axis2 c=gray44 label=none order=('01jan2009'd to '01jan2010'd by month) minor=none offset=(0,0); symbol1 font='albany amt/unicode' v='25cf'x h=6 interpol=spline w=1 color=cx6a3de4; symbol2 font='albany amt/unicode' v='25cf'x h=6 interpol=spline w=1 color=cxff8200; symbol3 font='albany amt/unicode' v='25cf'x h=6 interpol=spline w=1 color=cx4bcf94; legend1 label=none mode=protect position=(top left inside) across=1 cframe=white cborder=gray33 offset=(4,-5); title1 h=5 " "; title2 h=1 a=90 " "; /* left side space */ title3 h=3 a=-90 " "; footnote1 h=2 " "; proc gplot data=graph1 anno=back1; format date monname3.; format col1 dollar10.0; plot col1*date=_label_ / vaxis=axis1 haxis=axis2 autovref cvref=graycc autohref chref=graycc legend=legend1 anno=greenbar html=my_html html_legend=my_html2 des='' name='graph1'; run; /* graph 2 */ goptions xpixels=435 ypixels=248.5; data graph2; format pct percent5.0; input statecode $ 1-2 pct; state=fipnamel(stfips(statecode)); length my_html $200; my_html= 'title='||quote(trim(left(state))||': '||put(pct,percent5.0)) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; datalines; MN .11 WI .18 MI .10 IL .25 OH .15 IN .21 ; run; pattern1 v=s c=cxeacf43; pattern2 v=s c=cxce2727; pattern3 v=s c=cx90db9c; pattern4 v=s c=cx6c60e1; pattern5 v=s c=cxd67b29; pattern6 v=s c=cx8dd5e9; title; footnote; legend1 label=(position=top justify=center font="arial/bold" 'State') cframe=white cborder=gray33 across=1 position=(right middle) shape=bar(.10in,.10in) offset=(-7,0); proc gchart data=graph2 anno=back1; donut state / type=sum sumvar=pct clockwise angle=90 noheading value=inside coutline=cx839d9c slice=none legend=legend1 /* Oops - there's a bug with donut charttips, with 'descending' ordering (pie chart works right, but donut does not!) S0630657 */ html=my_html /* descending */ html_legend=my_html des='' name='graph2'; run; goptions xpixels=315 ypixels=252; axis1 c=gray44 label=none value=(justify=right) offset=(7,7); axis2 c=gray44 label=none order=(0 to 100000 by 25000) value=(h=4.5 t=1 '$0' t=2 '$25k' t=3 '$50k' t=4 '$75k' t=5 '$100k') minor=none offset=(0,5); pattern1 v=solid color=cxd3b684; /* annotate the 'green bar' background */ data greenbar2; length function $8 style $15 color $15; xsys='1'; ysys='1'; hsys='3'; when='b'; do i = 0 to (100-(100/5)) by (100/5); counter+1; even_odd=mod(counter,2); y=i; x=0; function='move'; output; y=i+(100/5); x=100; function='bar'; style='solid'; line=0; if even_odd=1 then color='cxdfe1e2'; else color='cxfcfdfd'; output; y=i; x=0; function='move'; output; y=i+(100/5); x=100; function='bar'; style='empty'; line=0; color='graycc'; output; end; run; data legend; length function $8 style $15 color $15 text $50; xsys='3'; ysys='3'; hsys='3'; when='a'; function='move'; x=5; y=91; output; function='bar'; x=x+6; y=y+3; style='solid'; line=0; color="cx66ff66"; output; function='move'; x=25; y=91; output; function='bar'; x=x+6; y=y+3; style='solid'; line=0; color="cxd3b684"; output; function='move'; x=5; y=91; output; function='bar'; x=x+6; y=y+3; style='empty'; line=0; color="cx839d9c"; output; function='move'; x=25; y=91; output; function='bar'; x=x+6; y=y+3; style='empty'; line=0; color="cx839d9c"; output; function='label'; size=5; color=''; position='5'; x=17; y=93.5; text='Profit'; output; x=40; y=93.5; text='Revenue'; output; run; data graph3; format revenue profit dollar10.0; input name $ 1-20 revenue profit; length my_html $200; my_html= 'title='||quote(trim(left(name))||':'||'0d'x|| 'Revenue = '||put(revenue,dollar10.0)||'0d'x|| 'Profit = '||put(profit,dollar10.0)||'0d'x|| '----------'||'0d'x|| trim(left(put(profit/revenue,percent7.0)))||' profit' ) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; datalines; Gretch 23300 9200 Yamaha 24100 10900 ESP 41700 20400 Gibson 53900 17400 Fender 91000 37500 ; run; data anno3; set graph3; length function $8 style $15 color $15; ysys='2'; hsys='3'; when='a'; function='move'; xsys='1'; x=.4; midpoint=name; output; function='draw'; xsys='2'; x=profit; size=8; color='cx66ff66'; output; function='label'; xsys='2'; size=4.5; color='gray44'; position='c'; x=profit; text=' '||trim(left(round(profit/1000))); output; x=revenue; text=' '||trim(left(round(revenue/1000))); output; run; data anno_all; set greenbar2 anno3 legend; run; title1 ls=1.5 justify=right font="arial/bold" c=gray44 "Guitar Sales "; title2 a=-90 h=5 " "; proc gchart data=graph3 anno=back1; hbar name / type=sum sumvar=revenue ascending width=4 space=3 nostats maxis=axis1 raxis=axis2 coutline=cx839d9c cframe=cxf0f3f6 autoref cref=graycc clipref anno=anno_all html=my_html des='' name='graph3'; run; data graph4; format revenue profit dollar10.0; input name $ 1-20 revenue profit; length my_html $200; my_html= 'title='||quote(trim(left(name))||':'||'0d'x|| 'Revenue = '||put(revenue,dollar10.0)||'0d'x|| 'Profit = '||put(profit,dollar10.0)||'0d'x|| '----------'||'0d'x|| trim(left(put(profit/revenue,percent7.0)))||' profit' ) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; datalines; Nady 17312 6812 M-Audio 17920 7900 TPS 30240 12308 Shure 39922 11080 Mackie 70451 27120 ; run; data anno4; set graph4; length function $8 style $15 color $15; ysys='2'; hsys='3'; when='a'; function='move'; xsys='1'; x=.4; midpoint=name; output; function='draw'; xsys='2'; x=profit; size=8; color='cx66ff66'; output; function='label'; xsys='2'; size=4.5; color='gray44'; position='c'; x=profit; text=' '||trim(left(round(profit/1000))); output; x=revenue; text=' '||trim(left(round(revenue/1000))); output; run; data anno_all; set greenbar2 anno4; run; title1 ls=1.5 justify=right font="arial/bold" c=gray44 "Recording Equipment Sales "; title2 a=-90 h=5 " "; proc gchart data=graph4 anno=back1; hbar name / type=sum sumvar=revenue ascending width=4 space=3 nostats maxis=axis1 raxis=axis2 coutline=cx839d9c cframe=cxf0f3f6 autoref cref=graycc clipref anno=anno_all html=my_html des='' name='graph4'; run; data graph5; format revenue profit dollar10.0; input name $ 1-20 revenue profit; length my_html $200; my_html= 'title='||quote(trim(left(name))||':'||'0d'x|| 'Revenue = '||put(revenue,dollar10.0)||'0d'x|| 'Profit = '||put(profit,dollar10.0)||'0d'x|| '----------'||'0d'x|| trim(left(put(profit/revenue,percent7.0)))||' profit' ) ||' '|| 'href='||quote('http://support.sas.com/rnd/datavisualization/dashboards/generic_drilldown.htm') ; datalines; Acoustic 17400 6720 Yorkville 18004 8400 Crate 30132 14560 Peavey 38080 12880 Marshall 67200 26880 ; run; data anno5; set graph5; length function $8 style $15 color $15; ysys='2'; hsys='3'; when='a'; function='move'; xsys='1'; x=.4; midpoint=name; output; function='draw'; xsys='2'; x=profit; size=8; color='cx66ff66'; output; function='label'; xsys='2'; size=4.5; color='gray44'; position='c'; x=profit; text=' '||trim(left(round(profit/1000))); output; x=revenue; text=' '||trim(left(round(revenue/1000))); output; run; data anno_all; set greenbar2 anno5; run; title1 ls=1.5 justify=right font="arial/bold" c=gray44 "Amp Sales "; title2 a=-90 h=5 " "; proc gchart data=graph5 anno=back1; hbar name / type=sum sumvar=revenue ascending width=4 space=3 nostats maxis=axis1 raxis=axis2 coutline=cx839d9c cframe=cxf0f3f6 autoref cref=graycc clipref anno=anno_all html=my_html des='' name='graph5'; run; data banner; length function $8 style $15; xsys='3'; ysys='3'; hsys='3'; when='a'; imgpath='musikasa_banner.jpg'; style='fit'; function='move'; x=0; y=83; output; function='image'; x=100; y=100; output; run; data titles; length function color $8 style $15 text $50; xsys='3'; ysys='3'; hsys='3'; when='a'; function='label'; position='6'; style='"arial/bold"'; color='gray11'; size=2.6; x=3; y=80.5; text='Yearly Revenue'; output; x=3; y=40.5; text='Top Brand Sales'; output; x=58; y=80.5; text='Store Percentage Breakdown'; output; run; data all_anno; set banner back2 titles; run; goptions xpixels=1000 ypixels=700; title "Foo"; proc gslide anno=all_anno des='' name='titl1'; run; goptions display; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Musikasa Dashboard") style=minimal; goptions noborder; proc greplay tc=tempcat nofs igout=gseg; tdef musik des='Dashboard' 0/llx = 0 lly = 0 ulx = 0 uly = 100 urx =100 ury = 100 lrx =100 lry = 0 1/llx = 1 lly = 42.5 ulx = 1 uly = 78 urx =54.5 ury = 78 lrx =54.5 lry = 42.5 2/llx =55.5 lly = 42.5 ulx =55.5 uly = 78 urx =99 ury = 78 lrx =99 lry = 42.5 3/llx = 1 lly = 2.0 ulx = 1 uly = 38.0 urx =32.5 ury = 38.0 lrx =32.5 lry = 2.0 4/llx =33.5 lly = 2.0 ulx =33.5 uly = 38.0 urx =65.5 ury = 38.0 lrx =65.5 lry = 2.0 5/llx =66.5 lly = 2.0 ulx =66.5 uly = 38.0 urx =99 ury = 38.0 lrx =99 lry = 2.0 ; template=musik; treplay 0:titl1 1:graph1 2:graph2 3:graph3 4:graph4 5:graph5 des="" name="&name" ; run; quit; quit; ODS HTML CLOSE; ODS LISTING;