Hey everybody,
I created a stacked bar chart with the code:
ods graphics / reset width=16cm height=4cm;
title "Gender distribution" font=Arial;
proc sgplot data=newcomplete;
hbar Full / group=Gender BARWIDTH=.5 groupdisplay=stack stat=percent seglabel seglabelattrs=(Family=Arial size=10);
xaxis discreteorder=data;
styleattrs datacolors=("#D9D9D9" "#C5D4D8" "#B0BAD4" "#85BDB6" SKYBLUE) datalinepatterns=(solid) datacontrastcolors=(grey);
keylegend/ title=" "
titleattrs=(Size=1)
valueattrs=(Family=Arial Size=11);;
yaxis label="S8)"
valueattrs=(size=10);
XAXIS DISPLAY=(NOLABEL);
run;
The outcome is the picture below. Because I added the percent value of each segment in the bar already, I want to remove the percent values (0%...-...100%) on the x-axis scale.
Does anybody have an idea?
Thanks a lot!
I would do three things here:
1. Change XAXIS DISPLAY=(NOLABEL) to be DISLAY=NONE to get rid of the XAXIS completely
2. Add a YAXIS DISPLAY=NONE as an additional statement to get rid of the YAXIS completely
3. I would add the NOBORDER to the SGPLOT statement to get rid of the frame around the data area
Hope this helps!
Dan
You may try
XAXIS DISPLAY=(NOLABEL NOTICKS NOVALUES);
Thanks a lot Jag.
It works now 🙂
I would do three things here:
1. Change XAXIS DISPLAY=(NOLABEL) to be DISLAY=NONE to get rid of the XAXIS completely
2. Add a YAXIS DISPLAY=NONE as an additional statement to get rid of the YAXIS completely
3. I would add the NOBORDER to the SGPLOT statement to get rid of the frame around the data area
Hope this helps!
Dan
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.