BookmarkSubscribeRSS Feed
sandre42
Calcite | Level 5

I am new to SAS as an undergraduate student. After an hour or so of trying variations of code that I searched here on SAS Support, I cannot get any of them to work to change the colors on my 100% Stacked Bar Chart. Can somebody please help? Here is the code that we were provided to use for the chart.

 

 

proc freq data=project.studentdrink;
table dalc*studytime/out=freq outpct;
quit;
proc sgplot data=freq pctlevel=group;
vbar Dalc /
response=studytime
group=studytime
datalabel seglabel seglabelattrs=(size=8) stat=percent;
title '100% Stacked Bar Chart for Student Workday Alcohol Consumption by Study Time (n=395)';
yaxis label = 'Workday Alcohol Consumption by Study Time';
run;

 

fillattrs works within the code when I try it, although I have only been able to change it to one solid color and I need multiple colors if that's possible. Thank you. 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Have you tried to use the STYLEATTRS statement in PROC SGPLOT?

--
Paige Miller
joeFurbee
Community Manager

Hi @sandre42,

@PaigeMiller has you covered. Check out this article for the use of STYLEATTRS.


Join us for SAS Community Trivia

SAS Bowl LIII, SAS Hackathon 2025
Wednesday, August 25, 2025 at 10 am.
sandre42
Calcite | Level 5

Styleattrs worked! Thank you so much!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 2968 views
  • 3 likes
  • 3 in conversation