proc sgplot data=votes;
vbox savings / category=poverty;
xaxis type=discreate values=('0-10' '11-20' '21-30' '31-40' '41-50');
above is the code i am using when trying to create a boxplot but it comes out blank. Any ideas why?
The dataset has a savings column and a poverty column
My first thought would be the values of your category variable is a likely cause.
Is "poverty" a numeric variable that you are attempting to group into values of 1-10 for the plot? If so you might be better off with a custom format to create the groups.
Otherwise show a set of data that we can duplicate the behavior of the code with.
savings income poverty 57623 15768 15.2 84935 16954 13.6 83656 15532 25 61249 14820 15 75725 11120 33 75887 12015 27.1 76073 15162 18
Here is a sample of it
thank you for your assistance
So the reason your plot failed was none of the values of poverty matched the values of the value list in the axis statement.
proc format library=work; value povgrp 0 -<11 = ' 0-10' 11 -<21 = '11-20' 21 -<31 = '21-30' 31 -<41 = '31-40' 41 -<51 = '41-50' ; run; proc sgplot data=votes; vbox savings / category=poverty; format poverty povgrp.; run;
the custom format will create groups of values
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.
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.