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

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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
  • 339 views
  • 0 likes
  • 2 in conversation