BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kthartma
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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.

View solution in original post

1 REPLY 1
ballardw
Super User

@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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 908 views
  • 2 likes
  • 2 in conversation