Hi,
I can't really get the right options to display my desired graph using SGPLOT.
Code producing the below.
1. I want the value to be displayed on top of each bar ( in red)
2. I want to hide the values along the xaxis (highlighted in yellow)
The legend needs to be displayed at the bottom
data plot_graph;
infile datalines dlm=",";
input Exception $22. tot_pcnt;
datalines;
Tot_Number_Exception_A,2
Tot_Number_Exception_B,3
Tot_Number_Exception_C,10
Tot_Number_Exception_D,1
Tot_Number_Exception_E,1
;
run;
proc sgplot data=WORK.plot_graph;
vbar Exception /response=tot_pcnt group=Exception ;
yaxis grid values=(0 to 12 by 2) display=(nolabel);
xaxis display=(nolabel) display=(noticks);
run;
thanks for your help
Thanks for providing sample data, code and what you want!
For :
1. Add DATALABEL option to the VBAR statement
2. Change xaxis display option to NONE to suppress the XAXIS labels and tick marks.
proc sgplot data=WORK.plot_graph; vbar Exception /response=tot_pcnt group=Exception datalabel ; yaxis grid values=(0 to 12 by 2) display=(nolabel); xaxis display=none; run;
@YNWA1 wrote:
Hi,
I can't really get the right options to display my desired graph using SGPLOT.
Code producing the below.
1. I want the value to be displayed on top of each bar ( in red)
2. I want to hide the values along the xaxis (highlighted in yellow)
The legend needs to be displayed at the bottom
data plot_graph; infile datalines dlm=","; input Exception $22. tot_pcnt; datalines; Tot_Number_Exception_A,2 Tot_Number_Exception_B,3 Tot_Number_Exception_C,10 Tot_Number_Exception_D,1 Tot_Number_Exception_E,1 ; run; proc sgplot data=WORK.plot_graph; vbar Exception /response=tot_pcnt group=Exception ; yaxis grid values=(0 to 12 by 2) display=(nolabel); xaxis display=(nolabel) display=(noticks); run;
thanks for your help
Thanks for providing sample data, code and what you want!
For :
1. Add DATALABEL option to the VBAR statement
2. Change xaxis display option to NONE to suppress the XAXIS labels and tick marks.
proc sgplot data=WORK.plot_graph; vbar Exception /response=tot_pcnt group=Exception datalabel ; yaxis grid values=(0 to 12 by 2) display=(nolabel); xaxis display=none; run;
@YNWA1 wrote:
Hi,
I can't really get the right options to display my desired graph using SGPLOT.
Code producing the below.
1. I want the value to be displayed on top of each bar ( in red)
2. I want to hide the values along the xaxis (highlighted in yellow)
The legend needs to be displayed at the bottom
data plot_graph; infile datalines dlm=","; input Exception $22. tot_pcnt; datalines; Tot_Number_Exception_A,2 Tot_Number_Exception_B,3 Tot_Number_Exception_C,10 Tot_Number_Exception_D,1 Tot_Number_Exception_E,1 ; run; proc sgplot data=WORK.plot_graph; vbar Exception /response=tot_pcnt group=Exception ; yaxis grid values=(0 to 12 by 2) display=(nolabel); xaxis display=(nolabel) display=(noticks); run;
thanks for your help
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.