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;
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!
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.
Ready to level-up your skills? Choose your own adventure.