%let gpath=C:\;
%let dpi=200;
ods html close;
ods listing style=HTMLBlue gpath="&gpath" image_dpi=&dpi;
/*--Create data--*/
data school;
input Year Group $ Value;
format Value percent5.1;
datalines;
2010 School .
2010 County 0.45
2010 State 0.42
2011 School 0.54
2011 County 0.46
2011 State 0.44
run;
/*--Default bar labels--*/
ods graphics / reset width=5in height=3in imagename="Bar_Label";
title 'Student Performance';
proc sgplot data=school noborder;
vbarparm category=year response=value / group=group groupdisplay=cluster
displaybaseline=auto datalabel dataskin=pressed;
xaxis display=(noticks noline nolabel);
yaxis display=(noticks nolabel noline) grid;
run;
/*--Create new columns--*/
data school2;
set school;
format Value2 percent5.1;
length label $6;
label=ifc(value, put(value, percent5.1), "N/A");
Value2=ifn(value, value, 0);
run;
/*--Custom bar labels--*/
ods graphics / reset width=5in height=3in imagename="Custom_Bar_Labels";
title 'Student Performance';
proc sgplot data=school2 noborder;
vbarparm category=year response=value2 / group=group groupdisplay=cluster
displaybaseline=auto datalabel=label nozerobars dataskin=pressed;
xaxis display=(noticks noline nolabel);
yaxis display=(noticks nolabel noline) grid;
run;