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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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