BookmarkSubscribeRSS Feed
vstorme
Obsidian | Level 7

I have the following code:

 

proc sgplot data = &lib..&sasdsn ;
format amyloplastheight 7.1 ;
vbar treat / group=gt response=amyloplastheight stat=mean  dataskin=crisp
					limits=both limitstat=clm groupdisplay=cluster datalabel datalabelattrs=(size=6); 
yaxis label="amyloplastheight (^{unicode mu}m)" grid; 
keylegend /position =bottom title="genotype" sortorder=ascending;
run;

However, I cannot control the format of the lower and upper limits that are also displayed.

 

Thanks for any suggestions.

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Where do you want the confidence limits to appear?

 

Can you show us some sample data if you want a code answer?

ballardw
Super User

Also which version of SAS are you running. There have been significant additions to graphics option in each release for quite awhile. A solution that works for SAS 9.4m5 may not work for 9.4m4.

vstorme
Obsidian | Level 7

I can give you an example with a sashelp datastep:

 

ods html style = analysis ;
title font=Arial height=14pt 'barchart with 95% CL' ; 
proc sgplot data=sashelp.shoes;
format sales 8.2;
vbar region / response=sales stat=mean  dataskin=crisp
				   limits=both limitstat=clm groupdisplay=cluster 
                   datalabel datalabelattrs=(size=6); ;
run;
title;

In the bottom, the mean is displayed with format 8.2 as requested, however also the limits are displayed with another format. I did not particularly want the limits in the bottom, but if they are, they should have the same format.

I am using SAS 9.4 1M5

andypandy_swe
Obsidian | Level 7

Did you solve it?

I'm struggling with the same thing...

I'm using stat=mean on a variable containing 1/0 (formatted with percent8.)  to get percentages (because I want upper and lower clm. The datalabel options gives the formatted value on the middle row but the upper limit and lower limit value is in decimal... Any way to change these to percent? 

andypandy_swe_0-1654162875998.png

 

DanH_sas
SAS Super FREQ

For the record, the DATALABEL option on bar charts cannot put a label on top of a bar when there are limits enabled. If you try it, we will automatically switch to axis tables internally to display the information (we do this as a convenience). If you know that you want to customize these labels in this situation, it is best to go ahead and use axis tables directly.

 

Hope this helps!

Dan

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
  • 6 replies
  • 1151 views
  • 2 likes
  • 6 in conversation