BookmarkSubscribeRSS Feed
HowardTien
Calcite | Level 5

Hello,

I am trying to use PROC boxplot with BLOCK statments,

it works fine while using raw data.

But it seems dosen't work while using the BOX data.

For example:

/*Using the raw data, outputs - box_raw*/

proc boxplot data=eg_out1;

    plot EGRN*n(abbr VISID)/outbox=out1;

run;

/*Using the BOX data, outputs - box_box*/

proc boxplot box=out1;

    plot EGRN*n(abbr VISID);

run;

The boxplots parts  in both outputs are the same, but the BLOCK parts is incorrect while using the BOX data inputs.

Is there any way to solve this ?

Thank you!


box_box.PNGbox_raw.PNG
3 REPLIES 3
data_null__
Jade | Level 19

Maybe you just need to sort the data by the BLOCK variables.

BuckyRansdell
SAS Employee

Hi Howard,

It's difficult for me to determine what's going on without seeing the data.  Note that block variables are intended to identify blocks of box-and-whisker charts.  The values of the block variables (abbr and VISIS) should be the same for all observations contributing to one box, i.e. those with the same value of the group variable, n.  Does your data fit that description?

Bucky

HowardTien
Calcite | Level 5

Hello,

To  Bucky:

The raw data is like this:

EGRN.  abbr.  visid.   n

10.         PBO.  20.     1

25          PBO.  20.     1

16          PBO.  20.     1

...

18.         TRT1. 20.     2

14.         TRT1. 20.     2

23          TRT1. 20.     2

...

16          TRT2. 20.     3

...

29          PBO . 30.     4

...

17          TRT1 . 30.     5

...

And the dataset out1 is something like this:

n  _type_      _var_   _value_  abbr.  visid

1     N           EGRN     201      PBO   20

1    MEAN    EGRN    21.2      PBO   20

1    MAX       EGRN    24        PBO   20

...

2     N           EGRN     211      TRT1   20

2    MEAN    EGRN    23.2      TRT1   20

2    MAX       EGRN    25        TRT1   20

...

3     N           EGRN     281      TRT2   20

3    MEAN    EGRN    21.2      TRT2   20

3    MAX       EGRN    29        TRT2   20

...

4     N           EGRN     219      PBO   30

4    MEAN    EGRN    22.2      PBO   30

4    MAX       EGRN    27        PBO   30


...

n is simply a dummy variable, and dataset out1 is the

summary datasets of the raw data using PROC BOXPLOT, and I think

the data fit the description.


To data _null_ :


I'll try to sort the BLOCK variable tomorrow, and let you know if it works or not.


Thank you!


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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1361 views
  • 0 likes
  • 3 in conversation