BookmarkSubscribeRSS Feed
pdrsn13
Calcite | Level 5

I am comparing median laboratory values and mortality.  I have 10 different labs on about 400 patients.  I have created a box and whisker plot for each lab individually and mortality - see simple example code below.  I would like them to all be included in one panel such as with sgpanel but since they are separate variables, I haven't been able to figure it out.  They would each require their own Y axis since they have different scales.

 

I would also love help with labeling mortality (outcome, 0 = deceased, 1 = survived) on the x-axis.

 

proc sgplot data=eb;
title 'AST overall value by survival';
vbox AST / category=outcome;
run;

1 REPLY 1
acordes
Rhodochrosite | Level 12
data test;
array temp (*) _NUMERIC_ val1-val10;

do client=1 to 400;
do j=1 to dim(temp);
temp(j)=ceil(rand('integer',1,10) + rand("normal", mod(client, 5), rand('bernoulli', rand('integer',1,10)/10))) ;
end;
client_id=cats("id_", client);
outcome= rand('bernoulli', mod(client, 3)/2);
output;
end;

drop client j;

run;

proc format;
value outy
0='deceased'
1='survived'
;
run;


ods graphics on;
proc sgplot data=test;
format outcome outy.;
title 'AST overall value by survival';
vbox val1 / category=outcome;
run;

proc transpose data=test out=long(rename=(col1=value));
by client_id outcome notsorted;
var val1-val10;
run;

proc sgpanel data=long;
panelby _name_;
format outcome outy.;
vbox value / category=outcome;
run;

pic.png

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 952 views
  • 0 likes
  • 2 in conversation