Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
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/

The Boston Area SAS Users Group is hosting free webinars!
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1797 views
  • 0 likes
  • 3 in conversation