In the presented Grotta barcharts, the same text color is applied to all segments.
Is it possible to apply different text colors to different segments (eg. white for dark backgrounds and black for other backgrounds) with proc sgplot simply or must proc template/sgrender be used?
With proc sgplot, I only see the text statement (but needs lots of data preparation for it) and annotations as possible solution. Correct?
It does not look like so hard I think .Just prepare the data and using TEXT statement.
proc freq data=sashelp.heart noprint;
table status*bp_status/out=temp outpct;
run;
data want;
set temp;
by status;
if first.status then cum_pct=0;
pct=PCT_ROW*0.01;
cum_pct+pct;
x=cum_pct-pct/2;
format cum_pct pct x percent8.2;
run;
proc sgplot data=want;
styleattrs datacontrastcolors=(black white navy);
hbarparm category=status response=pct/group=bp_status nooutline;
text x=x y=status text=pct/strip contributeoffset=none group=bp_status textattrs=(size=14);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.