BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
s192403
Fluorite | Level 6

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.

 

s192403_0-1632235075723.png

 

Does anybody have an idea?

 

Thanks a lot!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

View solution in original post

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

You may try 

 

XAXIS DISPLAY=(NOLABEL NOTICKS NOVALUES);

Thanks,
Jag
s192403
Fluorite | Level 6

Thanks a lot Jag. 

It works now 🙂 

 

DanH_sas
SAS Super FREQ

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

s192403
Fluorite | Level 6
Thanks a lot Dan.
It works now and the additional comments help me a lot.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 3243 views
  • 5 likes
  • 3 in conversation