ods html close; %let gpath=C:\Work\Blogs\Graphically Speaking\2017\Post_30_Sep_10_Bar_Color_Response; %let w=5in; %let h=2.5in; %let dpi=200; ods listing gpath="&gpath" image_dpi=&dpi; data ibm; label vol2='Volume in millions'; set sashelp.stocks(where=(stock='IBM' and date < '01Jan1992'd)); vol2=volume/1000000; run; /*--Regular discrete bar chart--*/ ods graphics / reset width=&w height=&h imagename='Bar_by_x'; title 'Stock Price over Time'; proc sgplot data=ibm noborder; vbar date / response=close nostatlabel; xaxis display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--Linear bar chart--*/ ods graphics / reset width=&w height=&h imagename='Bar_on_Linear_x'; title 'Stock Closing Price Color by Time'; proc sgplot data=ibm noborder; vbar date / response=close nostatlabel; xaxis type=linear display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--Linear bar chart color response by time--*/ ods graphics / reset width=&w height=&h imagename='Bar_Color_by_Linear_x'; title 'Stock Closing Price over Time'; proc sgplot data=ibm noborder subpixel noautolegend; vbar date / response=close nostatlabel colorresponse=date colormodel=(green yellow red); xaxis type=time display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--Linear bar chart color response by time--*/ ods graphics / reset width=&w height=&h imagename='Bar_Color_by_Linear_y'; title 'Stock Closing Price Color by Close'; proc sgplot data=ibm noborder subpixel noautolegend; vbar date / response=close nostatlabel colorresponse=close dataskin=pressed colormodel=( red yellow green) barwidth=1 nooutline; xaxis type=time display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--Linear bar chart color response by Volume--*/ ods graphics / reset width=&w height=&h imagename='Bar_Color_by_Volume'; title 'Stock Closing Price Color by Volume'; proc sgplot data=ibm noborder subpixel; vbar date / response=close nostatlabel colorresponse=vol2 dataskin=pressed colormodel=( white red) barwidth=1 nooutline; xaxis type=time display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--HiglLow bar chart color response by Volume--*/ ods graphics / reset width=&w height=&h imagename='HighLow_Color_by_Volume'; title 'Stock Closing Price Color by Volume'; proc sgplot data=ibm noborder subpixel; highlow x=date low=low high=high / colorresponse=vol2 dataskin=pressed colormodel=( white red) barwidth=1 type=bar; xaxis type=time display=(nolabel); yaxis display=(noline noticks nolabel) grid; run; /*--Icon--*/ ods listing image_dpi=100; ods graphics / reset width=2.7in height=1.8in imagename='Bar_Color_Icon'; title 'Stock Closing Price Color by Close'; proc sgplot data=ibm noborder subpixel noautolegend; vbar date / response=close nostatlabel colorresponse=close dataskin=pressed colormodel=( red yellow green) barwidth=1 nooutline; xaxis type=time display=(nolabel); yaxis display=(noline noticks nolabel) grid; run;