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

Hello,

I want to execute a proc boxplot to get information on the dispersion of a continuous variable TI_NUM for each category of a variable "Groupe_villes_2". I ran this code :

 

proc boxplot data=PACIFICA.Pacifica_04_v3;
plot TI_NUM*groupe_villes_2 / maxpanels=15;
run;

 

But when I do so I get this output for the first plot :

BoxPlot.PNG

 

when the variables "groupe_villes_non_estimated" and "groupe_villes_0_2nd" are two (and only two) levels of the variable "groupe_villes_2".
You will find attached the output of the proc summary confirming the number of level of the categorical variable "groupe_villes_2". You will also find the output of the proc boxplot.

 

Thank you for your help !

 

NB : I don't have this error with this code :

 

PROC SGPLOT DATA= HAVE;
VBOX TI_NUM / category = groupe_villes_2;
RUN;

 

But there are so many levels that I can't see anything on the plot. I tried  :

 

ods graphics / DATASKINMAX=10;
PROC SGPLOT DATA=PACIFICA.Pacifica_04_v3;
VBOX TI_NUM / category = groupe_villes_2 ;
RUN;

 

but it doesn't work, I think I don't know how ods graphics works...

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

PROC BOXPLOT requires the data to be sorted by the x-axis variable. PROC SGPLOT does not require this.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

PROC BOXPLOT requires the data to be sorted by the x-axis variable. PROC SGPLOT does not require this.

--
Paige Miller
SteveDenham
Jade | Level 19

Another thing to do would be to partition the data set with an indexing variable, and then use a BY statement.  This would produce a set of boxplots for each partition, so that the overlap and readability are not a problem.  The issue then becomes being able to compare results in different sets.  For this dataset, where the dependent variable is a count, the Y axis should be roughly the same for all of the plots.  If not, you can use SGPLOT to set the Y axis range.  I don't see an option for this in PROC BOXPLOT.

 

SteveDenham 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 681 views
  • 1 like
  • 3 in conversation