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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.