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-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!

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
  • 1244 views
  • 0 likes
  • 2 in conversation