HI there,
I am having some difficulty changing the bar colors on my graphs.
Here is my code.
TITLE1 "Hypertension-Related Death Rates by State";
FOOTNOTE 'Created by Me';
PROC SGPLOT DATA = Hypertension.StatePercents;
VBAR StateCd / Response=colpercent
GROUPDISPLAY=cluster
DATALABEL = ColPercent
;
REFLINE 1.8
/ AXIS = Y
LABELLOC = inside
LINEATTRS=(COLOR = INDIGO PATTERN = SHORTDASH)
LABEL = 'National Average = 1.8';
XAXIS LABEL = 'State Code'
LABELATTRS= (WEIGHT = BOLD)
;
STYLEATTRS DATACOLORS= (LIGHTSALMON)
DATACONTRASTCOLORS= (BLACK)
;
YAXIS LABEL = 'PERCENT'
OFFSETMIN= 0
LABELATTRS= (WEIGHT = BOLD)
VALUES = (0,1,2,3,4)
GRID;
RUN;
TITLE;
FOOTNOTE;
my output is still using blue bars instead of salmon, any ideas?
To change all bars to use the same color use the FILLATTRS option on the VBAR statement.
VBAR StateCd / Response=colpercent
GROUPDISPLAY=cluster
DATALABEL = ColPercent
Fillattrs=(color=lightsalmon)
;
Your Styleattrs requires at least one GROUP= variable in a plot statement
Requirement For this option to have an effect, at least one plot statement in the procedure must specify the GROUP= option.
To change all bars to use the same color use the FILLATTRS option on the VBAR statement.
VBAR StateCd / Response=colpercent
GROUPDISPLAY=cluster
DATALABEL = ColPercent
Fillattrs=(color=lightsalmon)
;
Your Styleattrs requires at least one GROUP= variable in a plot statement
Requirement For this option to have an effect, at least one plot statement in the procedure must specify the GROUP= option.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.