libname blog 'C:\';
%let gpath='.';
ods html close;
/*--Draw graph using HBAR with full data--*/
%let dpi=200;
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset width=5in height=3in imagename='Product_1';
title "Open Defects for Product on &sysdate";
proc sgplot data=blog.product noborder;
hbar product / datalabel categoryorder=respdesc datalabelfitpolicy=none
datalabelattrs=(size=7);
yaxistable product support / position=left location=inside;
xaxis display=(nolabel noline noticks) grid;
yaxis display=none valueattrs=(size=6) fitpolicy=none;
run;
/*--Add a dummy analysis variable--*/
data product;
set blog.product;
x=10;
run;
/*--Compute frequencies by component, keep the primary support id--*/
proc means data=product noprint;
class product;
id support;
var x;
output out=freq(where=(_type_ > 0))
N=N;
run;
/*--Sort data by descending frequency--*/
proc sort data=freq;
by descending n;
run;
/*--Draw graph using HBARPARM with summarized data--*/
%let dpi=200;
ods listing gpath=&gpath image_dpi=&dpi;
ods graphics / reset width=5in height=3in imagename='Product_2';
title "Open Defects for Product on &sysdate";
proc sgplot data=freq(where=(n>10)) noborder;
hbarparm category=product response=n / datalabel
datalabelattrs=(size=9);
yaxistable product support / position=left location=inside;
xaxis display=(nolabel noline noticks) grid;
yaxis display=none fitpolicy=none;
run;