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

Hello,

 

Do you know if it is possible to use a line for the mean instead of a symbol on a boxplot please? The reason for this is a customer would like the output provided in Spotfire to be replicated.

 

From what I have seen, all the meanattrs option in VBOX, and BOXPLOTPARM relate to markers. I tried to also change the default template and modified the class in "GraphBoxMean" to a line but that didn't work.

 

The next thing I am thinking to do is use the drawline statement to draw a line for the mean, but would like to avoid that. Please let me know if you have any suggestions.

 

Thank you in advance. 🙂

 

I have SAS 9.4.

 

Kriss

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Unfortunately, it appears you will need to annotate those lines. I would use the annotation data set instead of the DRAWLINE statements, as that will give a better chance to automate the line creation. 

View solution in original post

4 REPLIES 4
DanH_sas
SAS Super FREQ

I do not see a picture of what you want, but run this code and see if this will work for you.

 

proc sgplot data=sashelp.heart;
   symbolchar name=mean char='2015'x;
   vbox cholesterol / category=weight_status meanattrs=(symbol=mean size=50px) nomedian;
run;

Note that tradition box plots use lines for medians, so I hope the consumers of the plot do not find it confusing.

 

djrisks
Barite | Level 11

Thank you for this Dan. It's definitely in the right direction. For the mean, the customer wanted the line to look like the line of the median, but instead be dashed, instead of a solid line. I agree, I thnk the conventional symbol does look better, but was asked to replicate the output in spotfire if possible.

 

Is there a way that the width of the mean symbolchar (line) can be extended but not the height please? And also to use a symbolchar with a dash please?

 

Thank you.

 

 

 

DanH_sas
SAS Super FREQ

Unfortunately, it appears you will need to annotate those lines. I would use the annotation data set instead of the DRAWLINE statements, as that will give a better chance to automate the line creation. 

djrisks
Barite | Level 11

Thank you Dan! Yes annotation is a better choice. Thanks.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 1700 views
  • 3 likes
  • 2 in conversation