%let name=oil_blinged; filename odsout '.'; /* I started with data from examples on the following website... http://www.corda.com/company/resources/PopChart.pdf And then tried to make a dashboard that was more functional than theirs :) */ goptions xpixels=1000 ypixels=775; /* Gradient background */ data grad_rev; length function style color $10; retain xsys '3' ysys '3' when 'b' style 'solid'; orig_red= input('8f',hex2.); orig_green=input('bc',hex2.); orig_blue= input('8f',hex2.); do i=2 to 100 by 2; count+1; function='move'; x=0; y=i; output; function='bar'; x=100; y=i-2; percent=(count-1)/(60); red=orig_red + ( (256-orig_red) * percent ); if red > 255 then red=255; green=orig_green + ( (256-orig_green) * percent ); if green > 255 then green=255; blue=orig_blue + ( (256-orig_blue) * percent ); if blue > 255 then blue=255; rgb=put(red,hex2.)||put(green,hex2.)||put(blue,hex2.); color="cx"||rgb; output; end; run; data prodbar; input category $1-15 year mbarrels; length myhtml $ 200; myhtml= 'title='||quote(trim(left(category))||': '||trim(left(mbarrels)))|| ' href="oil_unblinged.htm"'; datalines; South 1998 30 South 1999 40 South 2000 50 South 2001 60 South 2002 70 Northeast 1998 60 Northeast 1999 59 Northeast 2000 58 Northeast 2001 60 Northeast 2002 60 ; run; /* Summary line */ proc sql; create table prod_anno as select unique year, sum(mbarrels) as mbarrels, 'foo' as fakeby from prodbar group by year; quit; run; data prod_anno; set prod_anno end=last; by fakeby; length function color $8 text $30; length html $200; retain xsys ysys '2' color 'cxEEC900' when 'a' size 4 position '5'; html='title='||quote( 'Year '||trim(left(year))||' total production: '||trim(left(mbarrels))||' M barrels '); if first.fakeby then function='move'; else function='draw'; midpoint=year; y=mbarrels; output; function='symbol'; text='dot';size=3; midpoint=year; y=mbarrels; output; run; proc format; value catfmt 1='Other' 2='Chemicals' 3='Diesel' 4='Jet Fuel' 5='Gasoline' ; value linefmt 1='ANS West Coast' 2='Berry Petroleum' 3='West Texas Int.' 4='Average' ; run; data prodplot; format category catfmt.; input category year mbarrels; length myhtml $ 200; myhtml= 'title='||quote(trim(left(put(category,catfmt.))))|| ' href="oil_unblinged.htm"'; datalines; 1 1998 28 1 1999 29 1 2000 28 1 2001 30 1 2002 29 2 1998 30 2 1999 32 2 2000 31 2 2001 33 2 2002 32 3 1998 45 3 1999 46 3 2000 47 3 2001 48.5 3 2002 50 4 1998 60 4 1999 59 4 2000 58 4 2001 63 4 2002 65 5 1998 100 5 1999 105 5 2000 110 5 2001 125 5 2002 130 ; run; data lineplot; format category linefmt.; input category year dpbarrel; length myhtml $ 200; myhtml= 'title='||quote(trim(left(put(category,linefmt.)))||' ('||trim(left(year))||') : $'||trim(left(dpbarrel)))|| ' href="oil_unblinged.htm"'; datalines; 1 1998 12 1 1999 19 1 2000 26 1 2001 23 1 2002 24 2 1998 9 2 1999 18 2 2000 16 2 2001 19 2 2002 20 3 1998 11 3 1999 19 3 2000 27 3 2001 25 3 2002 25 4 1998 10.67 4 1999 18.67 4 2000 23 4 2001 22.33 4 2002 23 ; run; data expbar; input category $1-15 year mdollars; format mdollars dollar10.0; length myhtml $ 200; myhtml= 'title='||quote(trim(left(category))||': '||trim(left(put(mdollars,dollar10.0))))|| ' href="oil_unblinged.htm"'; datalines; South 1998 1000 South 1999 1000 South 2000 1000 South 2001 1100 South 2002 1000 Northeast 1998 900 Northeast 1999 950 Northeast 2000 950 Northeast 2001 1100 Northeast 2002 1100 ; run; /* Summary line */ proc sql; create table exp_anno as select unique year, sum(mdollars) as mdollars, 'foo' as fakeby from expbar group by year; quit; run; data exp_anno; set exp_anno end=last; by fakeby; length function color $8 text $30; length html $200; retain xsys ysys '2' color 'cxEEC900' when 'a' size 4 position '5'; html='title='|| quote( 'Year '||trim(left(year))||' total expenses: '||trim(left(put(mdollars,dollar10.0)))||' M '); if first.fakeby then function='move'; else function='draw'; midpoint=year; y=mdollars; output; function='label'; text='$';size=3; midpoint=year; y=mdollars; output; run; /* Customize the ods style, so you can color the background of the webpage... */ ods path work.template(update) sashelp.tmplmst; proc template; define style styles.airline; parent = styles.default; replace color_list / "backclr" = cx567E3A ; replace colors / "docbg" = color_list("backclr") ; end; goptions device=png; goptions cback=cx8FBC8F; goptions noborder; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Oil Decision Dashboard - blinged (Created with SAS/Graph)") style=airline options(pagebreak='no'); goptions nodisplay; goptions gunit=pct htitle=6 ftitle="arial/bold" htext=4 ftext="arial"; title1 box=1 bcolor=grayee color=cx567E3A justify=left "Oil Production: 1998-2002"; axis1 label=(a=90 'Millions of Barrels') order=(0 to 150 by 30) minor=none offset=(0,0); axis2 label=none offset=(9,6); legend1 label=none position=(top) down=1 shape=bar(2,3); pattern1 v=s c=cx238E68; pattern2 v=s c=cx473C8B; proc gchart data=prodbar anno=grad_rev; vbar3d year / discrete type=sum sumvar=mbarrels legend=legend1 subgroup=category raxis=axis1 maxis=axis2 autoref cref=gray coutline=gray cframe=grayee width=9 space=8 html=myhtml anno=prod_anno name='prodbar'; run; title1 box=1 bcolor=grayee color=cx567E3A justify=left "Refinery Expenses: 1998-2002"; title2 a=-90 h=4 " "; axis1 label=(a=90 'Millions of Dollars') order=(0 to 2500 by 500) minor=none offset=(0,0); axis2 label=none offset=(10,5); legend1 label=none position=(top) down=1 shape=bar(2,3); pattern1 v=s c=cx238E68; pattern2 v=s c=cx473C8B; proc gchart data=expbar anno=grad_rev; vbar3d year / discrete type=sum sumvar=mdollars subgroup=category legend=legend1 raxis=axis1 maxis=axis2 autoref cref=gray coutline=gray cframe=grayee shape=prism width=13 html=myhtml anno=exp_anno name='expbar'; run; title1 box=1 bcolor=grayee color=cx567E3A justify=left "Oil Production: 1998-2002"; axis1 label=(angle=90 'Millions of Barrels') order=(0 to 150 by 30) minor=none offset=(0,0); axis2 label=none minor=none offset=(0,0); symbol1 i=join font=marker v=U h=.1 c=cx473C8B; symbol2 i=join font=marker v=U h=.1 c=cxB22222; symbol3 i=join font=marker v=U h=.1 c=cxFFA54F; symbol4 i=join font=marker v=U h=.1 c=cxB452CD; symbol5 i=join font=marker v=U h=.1 c=cx008000; pattern1 v=s c=cx473C8B; pattern2 v=s c=cxB22222; pattern3 v=s c=cxFFA54F; pattern4 v=s c=cxB452CD; pattern5 v=s c=cx008000; legend1 label=none position=(top) value=(justify=left) down=1 repeat=1 order=descending; /* To create the 'illusion' of a stacked area chart, each successive category is really the sum of that category, and the previous ones. */ proc gplot data=prodplot anno=grad_rev; plot mbarrels*year=category / areas=5 vzero vaxis=axis1 haxis=axis2 autohref chref=gray autovref cvref=gray legend=legend1 html=myhtml name='prodplot'; run; title1 box=1 bcolor=grayee color=cx567E3A justify=left "Crude Oil Costs: 1998-2002"; axis1 label=(angle=90 'Dollars per Barrel') order=(8 to 28 by 4) minor=none offset=(0,0); axis2 label=none minor=none offset=(0,0); symbol1 i=join font=marker v=U h=1 w=8 c=green; symbol2 i=join font=marker v=U h=1 w=8 c=orange; symbol3 i=join font=marker v=U h=1 w=8 c=purple; symbol4 i=join font=marker v=U h=1 w=8 c=cxB22222; legend1 label=none position=(top) value=(justify=left) down=2 repeat=1; proc gplot data=lineplot anno=grad_rev; plot dpbarrel*year=category / legend=legend1 vaxis=axis1 haxis=axis2 autohref chref=gray autovref cvref=gray html=myhtml name='lineplot'; run; goptions display; goptions xpixels=180 ypixels=90; goptions cback=yellow border; title1 h=8pt " "; title2 h=16pt f="arial" link='oil_unblinged.htm' "Click here to"; title3 h=16pt f="arial/bold" link='oil_unblinged.htm' "Un-Bling"; title4 h=16pt f="arial" link='oil_unblinged.htm' "this dashboard!"; proc gslide des='' name="&name"; run; goptions xpixels=1000 ypixels=775; goptions cback=cx8FBC8F noborder; proc greplay tc=tempcat nofs igout=gseg; tdef airline des='Airline' 1/llx = 2 lly = 51 ulx = 2 uly = 97 urx =49 ury = 97 lrx =49 lry = 51 color=black 2/llx = 2 lly = 3 ulx = 2 uly = 49 urx =49 ury = 49 lrx =49 lry = 3 color=black 3/llx =51 lly = 51 ulx =51 uly = 97 urx =98 ury = 97 lrx =98 lry = 51 color=black 4/llx =51 lly = 3 ulx =51 uly = 49 urx =98 ury = 49 lrx =98 lry = 3 color=black ; template=airline; treplay 1:prodbar 3:prodplot 2:lineplot 4:expbar des='' name="&name"; run; quit; quit; ODS HTML CLOSE; ODS LISTING;