Usage Note 24496: How can I get a single box plot if I have only one variable in my data set?
A grouping variable is required in the PLOT statement in PROC BOXPLOT. So to get a single box-and-whisker plot for a variable, you need to create a constant grouping variable. Another approach is to use PROC SGPLOT, where a grouping variable is not required.
Here are some examples. These statements create a data set that contains random values for variable X for which the plots are produced:
data a;
do i=1 to 25;
x=rannor(4308);
output;
end;
drop i;
run;
These statements add a constant grouping variable for use in PROC BOXPLOT:
data a;
set a;
group=1;
run;
The following PROC BOXPLOT step produces the single box plot for X by specifying the constant grouping variable.
proc boxplot data=a;
plot x*group / odstitle=none;
run;
You can disable ODS GRAPHICS and use an AXIS statement to suppress the horizontal axis label as well as the box-and-whisker plot tick mark and its label :
ods graphics off;
axis1 label=none value=none major=none;
proc boxplot data=a;
plot x*group / haxis=axis1 boxwidth=10;
run;
ods graphics;

This PROC SGPLOT step produces the plot without the need for an additional grouping variable:
proc sgplot data=a;
vbox x;
run;
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Usage Note |
Priority: | low |
Topic: | SAS Reference ==> Procedures ==> BOXPLOT
|
Date Modified: | 2019-01-25 09:27:03 |
Date Created: | 2006-03-09 15:45:49 |