BookmarkSubscribeRSS Feed
Tz
Obsidian | Level 7 Tz
Obsidian | Level 7

Hi all.

I created a boxplot using SGPLOT:

proc sgplot data=Sample;

vbox CDRSUM / connect=median category=NACCFDYSYear group=cases_A__control_B;

run;

I want to add the number of available observations for each year to the bars.

Does anyone know how to do this?

Thanks

 

 

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

What do you mean by 'available observations'?

 

Where should the number appear? Inside the bar? The number will be pretty small.

Tz
Obsidian | Level 7 Tz
Obsidian | Level 7
I need the number to be above the bar. Thanks
ballardw
Super User

It is always a good idea to discuss items in terms of the VARIABLE names. We really do not know anything that tells us "observations for each year" or which variable actually is a year.

I guess you may be asking about the number of observations for NACCFDYSYear.

 

Also, where you want it the values to appear can make a big difference in approach.

If placing the value near the Xaxis is appropriate then perhaps:

xaxistable  NACCFDYSYear    /stat=freq;
Tz
Obsidian | Level 7 Tz
Obsidian | Level 7

Thanks for helping me. I tried xaxistable and recieved the following:

 

WARNING: The AXISTABLE supports only SUM and MEAN statistics when a bar

chart, line chart, or dot plot is not used. The SUM statistic will

be used by default.

 

So freq cannot be used with a box plot

 

Tz
Obsidian | Level 7 Tz
Obsidian | Level 7

The AXISTABLE cannot give frequencies for a box plot. Any other suggestions? Thanks