BookmarkSubscribeRSS Feed
JonDickens1607
Obsidian | Level 7

Can you use a format that was created with Proc Format in PROC BOXPLOT in oder to compare several groups associated with the format "bins" into which you have divided the grouping variable.

 

PROC FORMAT ;
VALUE LEVELS

0 <- 2 = 'A'
2 <- 6 = 'B'
6 <- 10 = 'C'
10 <- 12 = 'D'
12 <- 16 = 'E';
RUN;

PROC FREQ
DATA = QUIZDATA ;
TABLES NLEVELS / PLOTS = FREQPLOT ;
FORMAT NLEVELS LEVELS. ;
RUN;

 

The format works well with PROC FREQ.

 

How would you use it with PROC BOXPLOT as I just wish to compare the five groups A -E and not all the individual values.

 

If one actually creates a new variable by binning the variable NLEVELS using the same groups  as in PROC FORMAT

then you can use this new variable in PROC BOXPLOT for comparison.

1 REPLY 1
Rick_SAS
SAS Super FREQ

A box plot shows the distribution of a continuous variable. What is the continuous variable here?  I am assuming that you want to create five box plots, one each for A-E?

 

If there is a continuoius variable called Y, you can create five box plots like this

proc boxplot data=quizdata;

FORMAT NLEVELS LEVELS. ;

PLOT Y*NLEVELS;

run;

 

If you are trying to visualize the distribution within each group, then try this:

data A / view=A;

Grade = NLEVELS;  /* copy continuous variable */

run;

 

proc boxplot data=A;

FORMAT NLEVELS LEVELS. ;

PLOT Grade*NLEVELS;

run;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1348 views
  • 0 likes
  • 2 in conversation