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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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