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 LXI - SAS at 50 and SAS Innovate Recap
Wednesday, May 27, 2026 at 10 am ET.
sandre42
Calcite | Level 5

Styleattrs worked! Thank you so much!

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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
  • 3735 views
  • 3 likes
  • 3 in conversation