BookmarkSubscribeRSS Feed
BigD
Calcite | Level 5
I have some gcharts where the response bar are subdivided by another classification. Unfortunately, the percent number reported within the bar has 2 decimal places which takes up too much room. Is there anyway to get the percentage to display no decimal places?

Thanks,

Bruce


proc gchart data=new;
Vbar age /
TYPE=PCT
subgroup=disposition_new
Inside=subpct
G100
GROUP=age
NOZERO
Raxis=axis1
GAXIS=AXIS2
width=15
space=0
maxis=axis3
legend=legend3;
run;
6 REPLIES 6
Bill
Quartz | Level 8
Try using a format statement ...
BigD
Calcite | Level 5
I can't get a format on the subpercent because it is caluculated within the proc.
Bill
Quartz | Level 8
Could you post a few rows of data to go along with your code? Then others can play too.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Here is a SAS tech note I found at the SAS support http://support.sas.com/ website making a general reference to SUBPCT and needing to use the ANNOTATE facility. I would suggest you open a SAS support track to pursue your interest here.

Scott Barry
SBBWorks, Inc.

Sample 24887: Annotate values for each subgroup bar
http://support.sas.com/kb/24/887.html
BigD
Calcite | Level 5
Thanks to all,

A little pre-processing of the data to match the example given in the SAS note suggested by Barry and then it worked fine.

Thanks to all for your help.
dbcrow
Quartz | Level 8

I'm having this exact same problem.  The annotate could is turning out to be a little difficult to decipher; I'm not sure what some of it is doing, exactly (e.g., "a", xsys, ysys, position, "E", etc.).  Though an experienced Stata and R user, I'm getting up to speed in SAS. 

 

BigD:  could you please post the code that worked? 

 

Here're my data and code: 

 

Picture1.png

 

And the code: 

/*Figure 6:  Coalition Progress on Individual Activities (All Coalitions)*/
title1 "Progress on Individual Activities (All Coalitions)";
axis1 label=("Activity") value=(angle=45 rotate=0);
axis2 label=none value=none;
axis3 label=(angle=90 "Percent") value=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "80%" "90%" "100%") 
	minor=none;
PROC GCHART data=temp;
	format prog1 prog.;
	vbar count / type=percent subgroup=prog1 g100 group=Activity inside=pct
	gaxis=axis1 maxis=axis2 raxis=axis3 width=20;
RUN;

 

I get this graph, which is very nearly what I need, just that the two decimal points give an impression of a great precision that just isn't in the data! 

 

Picture2.png

 

I'd greatly appreciate any help! 

 

Thanks,

David

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 4085 views
  • 0 likes
  • 4 in conversation