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.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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