Hello,
I need to display a boxplot of a quantitative variable (Y) according to a binary variable (X) so i used this code :
PROC SGPLOT DATA=LNH;
vbox Y/category=X;
RUN;
But the boxplot is not readable ; the y axis scale is not appropriate since my quantitative variable has very small values :
Median = 5.20*10^-8;
Q1 (25%)= 4.02*10-9;
Q3 (75%)=3.12*10^-7 ;
Mininum value=0;
Maximum value=5.77*10^-4;
How can I change the y axis scale to get a relevant boxplot ?
Thank you in advance for your help !
Try adding a
yaxis values=(0 to 6E-4 by 1E-4); if you expect to display the maximum value, which likely won't show much of a box.
yaxis values=(0 to 5E-7 by 1E-7); to show the IQR but will trim out the larger values.
OR use a logarithmic axis
And possibly increase the size of the graphic area a bunch. Like at least 12 inches tall or 320CM.
The IQR is so small that you may still not see things because the thickness of the lines may be larger that values.
Try adding a
yaxis values=(0 to 6E-4 by 1E-4); if you expect to display the maximum value, which likely won't show much of a box.
yaxis values=(0 to 5E-7 by 1E-7); to show the IQR but will trim out the larger values.
OR use a logarithmic axis
And possibly increase the size of the graphic area a bunch. Like at least 12 inches tall or 320CM.
The IQR is so small that you may still not see things because the thickness of the lines may be larger that values.
Thank you for your reply !
Ok i will try these points but can you please tell me where exactly should i put yaxis values=(0 to 6E-4 by 1E-4) in my code cause it gave me errors.
And what is the code to use a logarithmic axis ?
Please note that my example included the ; to end the statement.
When you get errors copy the entire procedure code from the log, open a text box on the forum with the </> icon, then paste the copied text in the box. Include the entire procedure and all of the messages, not just the error.
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.