Hi there,
I am doing a boxplot and I am having issues differentiating vertical line colours. It seems like I can't get each line (2 of them...at 12 and at 5) to be different colours. Please see code below.
proc boxplot data=eval.pop;
plot latest_reg*seclatest_reg_cat/ vref=12 5 vreflabels= "90th percentile" "Target" cvref= red green;
inset min mean max stddev/
header = "Overall statistics"
pos= tm;
insetgroup min max/
header = "Extremes by performance";
label latest_ref= "Last reported reg rate";
label seclatest_ref_cat ="Performance based on second last reg rate";
run;
@kthartma wrote:
Hi there,
I am doing a boxplot and I am having issues differentiating vertical line colours. It seems like I can't get each line (2 of them...at 12 and at 5) to be different colours. Please see code below.
proc boxplot data=eval.pop;
plot latest_reg*seclatest_reg_cat/ vref=12 5 vreflabels= "90th percentile" "Target" cvref= red green;
inset min mean max stddev/
header = "Overall statistics"
pos= tm;
insetgroup min max/
header = "Extremes by performance";
label latest_ref= "Last reported reg rate";
label seclatest_ref_cat ="Performance based on second last reg rate";
run;
You don't do yourself favors by not posting the errors generated by your code. CVREF is going to allow a single color for all the reference lines. If you want to have different colors either go to annotate data set, probably not the best way, or move to SGPLOT with the VBOX or HBOX plot and as many REFLINE statements as needed. If you need all of the inset/ header/post options then you may have to settle for single color reference lines or go with annotate.
@kthartma wrote:
Hi there,
I am doing a boxplot and I am having issues differentiating vertical line colours. It seems like I can't get each line (2 of them...at 12 and at 5) to be different colours. Please see code below.
proc boxplot data=eval.pop;
plot latest_reg*seclatest_reg_cat/ vref=12 5 vreflabels= "90th percentile" "Target" cvref= red green;
inset min mean max stddev/
header = "Overall statistics"
pos= tm;
insetgroup min max/
header = "Extremes by performance";
label latest_ref= "Last reported reg rate";
label seclatest_ref_cat ="Performance based on second last reg rate";
run;
You don't do yourself favors by not posting the errors generated by your code. CVREF is going to allow a single color for all the reference lines. If you want to have different colors either go to annotate data set, probably not the best way, or move to SGPLOT with the VBOX or HBOX plot and as many REFLINE statements as needed. If you need all of the inset/ header/post options then you may have to settle for single color reference lines or go with annotate.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.