BookmarkSubscribeRSS Feed
n6
Quartz | Level 8 n6
Quartz | Level 8

 

I'm using PROC SGPANEL.  In the first panel I have side by side boxplots for Males and Females for Group A.  In the next panel same thing but for Group B.  Etc.  Five groups total.

 

But the person I'm doing this for doesn't want the whiskers extending from the boxplot to go to the highest observation that is below the upper fence, like the default is now, and understandably so because it's hard to explain when submitting it to a journal and nobody reading medical journals even knows what the upper fence is.  Instead this person wants the whiskers coming out of the boxplot to go to the 10th and 90th percentile.  Or maybe 5th and 95th.  Or maybe 20th and 80th.  They want to try a few things and see what looks good.  Since there are a couple extreme observations, having the whiskers go to the min and max is not good because it makes the box part get all scrunched and small.

 

In looking into SAS Help I see the HIGHLOW statement so that may be part of the solution.  But am I going to be able to do that for 10 groups (five for each of Male and Female) and still have side by side boxplots for Male and Female in five panels?  It seems too customized.  It would be really nice if I could just use the code I'm using now except adding a line that tells SAS what percentile to take the whiskers to, but I don't think that's possible.  I'd be happy to be proven wrong on that.

 

Any info is greatly appreciated.

3 REPLIES 3
Jay54
Meteorite | Level 14

Percentile option is available in both SGPLOT and SGPANEL with SAS 9.40M2.

With earlier release, you could use the HIGHLOW plot to simulate the result.  See:

http://blogs.sas.com/content/graphicallyspeaking/2013/03/24/custom-box-plots/

 

n6
Quartz | Level 8 n6
Quartz | Level 8

 

Do you know what the option is called?  Because in my SAS Help it says the Percentile option tells SAS how to determine how the percentiles are computed, rather than telling how far to extend the whiskers.

 

When I select "About SAS" from the Help menut I get "SAS 9.4 TS Level 1M1" so maybe (but hopefully not) that means my version of SAS won't do it.

Jay54
Meteorite | Level 14

The option WHISKERPCT is supported with SAS 9.40M2.  You seem to have SAS 9.40M1.  

You could use the method described in the blog article.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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