BookmarkSubscribeRSS Feed
sgilani
Calcite | Level 5

Hi,

 

I am using proc boxplot to generate the box plots that I need.

We have a couple of requirements for the figure we are trying to create:

1)  We need to have the summary statistics such as n, min max, outliers etc. in the box plot in the form of a table.  We have tried
the "insetgroup" option but it is not displaying the "NOUT" "NHIGH" and "NLOW" values which is the count of the outliers.

2) We also need to group the boxplots side by side by treatment.  Currently we are using in the plot statement the following code:

plot aval*avisitn  / boxstyle = schematic vref= 3.5 40.0  haxis = 1 to 19 by 1;

The y-axis values (aval) are result of lab tests and the x-axis values (avisitn) are the visits.  Hence we are plotting the lab values per visit.


We now need to group multiple treatments for each visit side by side.  We tried the following "plot aval*avisitn = trt02p".  This did
not give the desired result.  TRT02P is the treatment variable.

We are currently using SAS 9.4 on the server.  Can you suggest if these 2 situations can be accommodated in proc boxplot or not.


If anyone has an alternative approach then please specify.  I have tried proc sgplot and I am able to get the box plots side by side, however, the inset option is not automatically going to display the summary stats.  They will have to be calculated and manually put.

Since each lab test will be on a separate page i.e. plotting "by paramcd"  where paramcd is the unique lab test code, it will be difficult to code this.

 

Looking for suggestions.

 

Thanks.

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

I am no expert on PROC BOXPLOT, so I can not say if it can be done. I recommend using PROC SGPLOT. Have a look at this example and the solution by @Ksharp to get you started

 

https://communities.sas.com/t5/Base-SAS-Programming/proc-SGPLOT-vbox-summary-statistics-like-proc-bo...

 

Quentin
Super User

Suggest you post a small amount of sample data, for people to play with.  I agree with the suggestion to look into SGPLOT (or even GTL), for the box plot, and see the axistable statement for generating a table of summary statistics below the plot.  SGPLOT is very friendly, lots of examples at Sanjay Matange's blog, e.g.:

 

https://blogs.sas.com/content/graphicallyspeaking/2015/12/23/box-plot-with-stat-table-and-markers/

BASUG is hosting free webinars ! Check out our recordings of past webinars: https://www.basug.org/videos. Be sure to subscribe to our email list for notification of future BASUG events.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 1277 views
  • 0 likes
  • 3 in conversation