%let gpath=C:\; ods html close; %let w=4in; %let h=2in; %let dpi=200; ods listing gpath="&gpath" image_dpi=&dpi; data gaps; length Cat $8; input Cat $1-8 Value; datalines; 2014 570 2015 610 2016 645 A . Q1 2017 162 Q2 2017 164 Q3 2017 150 B . Oct 2017 50 Nov 2017 60 ; run; proc format; value $blank 'A' = ' ' 'B' = ' ' ; run; /*--Graph with discrete categories--*/ ods graphics / reset width=&w height=&h imagename='Blanks'; title 'Value by Period'; proc sgplot data=gaps noborder; vbar cat / response=value nostatlabel fillattrs=graphdata1; xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=(noline noticks nolabel) grid; run; /*--Graph with discrete categories and column format--*/ ods graphics / reset width=&w height=&h imagename='Blanks_Col_Format'; title 'Value by Period - Column Format'; proc sgplot data=gaps noborder; format cat $blank8.; vbar cat / response=value nostatlabel fillattrs=graphdata2; xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=(noline noticks nolabel) grid; run; /*--Graph with discrete categories and axis format--*/ ods graphics / reset width=&w height=&h imagename='Blanks_Axis_Format'; title 'Value by Period - Axis Format'; proc sgplot data=gaps noborder; vbar cat / response=value nostatlabel fillattrs=graphdata3; xaxis display=(noline noticks nolabel) discreteorder=data valuesformat=$blank8.; yaxis display=(noline noticks nolabel) grid; run; /*--Data set with segments--*/ data gaps_2; length Cat $8 Agg $8; input Cat $1-8 Value Agg $; datalines; 2014 570 Year 2015 610 Year 2016 645 Year Q1 2017 162 Qtr Q2 2017 164 Qtr Q3 2017 150 Qtr Oct 2017 50 Month Nov 2017 60 Month ; run; /*--Graph with discrete categories Refline--*/ ods graphics / reset width=&w height=&h imagename='Blanks_RefLine'; title 'Value by Period - Refline'; proc sgplot data=gaps_2 noborder; vbar cat / response=value nostatlabel fillattrs=graphdata4 barwidth=0.7; refline '2016' / axis=x discreteoffset=0.5; refline 'Q3 2017' / axis=x discreteoffset=0.5; xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=(noline noticks nolabel) grid; run; /*--Graph with discrete categories BlockPlot--*/ ods graphics / reset width=&w height=&h imagename='Blanks_Block'; title 'Value by Period - Blocks'; proc sgplot data=gaps_2 noborder; block x=cat block=agg / filltype=alternate; vbarparm category=cat response=value / fillattrs=graphdata1 barwidth=0.7; xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=(noline noticks nolabel) grid offsetmax=0.1; run; /*--Data set with segments--*/ data gaps_3; length Cat $8 Agg $10; input Cat $1-8 Value Agg $; datalines; 2014 570 Year 2015 610 Year 2016 645 Year Q1 162 2017-Qtr Q2 164 2017-Qtr Q3 150 2017-Qtr Oct 50 2017-Month Nov 60 2017-Month ; run; /*--Graph with discrete categories BlockPlot--*/ ods graphics / reset width=&w height=&h imagename='Blanks_Block_2'; title 'Value by Period - Blocks'; proc sgplot data=gaps_3 noborder; block x=cat block=agg / filltype=alternate; vbarparm category=cat response=value / fillattrs=graphdata2 barwidth=0.7; xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=(noline noticks nolabel) grid offsetmax=0.1; run; proc print;run;