SAS Users Group in Israel

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

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 5 replies
  • 1322 views
  • 2 likes
  • 3 in conversation