BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Aline1610
Fluorite | Level 6

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 !

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

6 REPLIES 6
ballardw
Super User

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.

Aline1610
Fluorite | Level 6

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 ?

 

 

Reeza
Super User
The YAXIS is a statement on it's own.
Look at the options within the statement (hint = TYPE) for how to set your axis as logarithmic.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0n6uml63c6h8dn16phbd1arm9g9.htm
Aline1610
Fluorite | Level 6
Thank you for the link it will help me !
ballardw
Super User

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.

Aline1610
Fluorite | Level 6
Ok thank u it's clearer

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 6 replies
  • 1088 views
  • 4 likes
  • 3 in conversation