08-14-2013 12:48 PM
I am using GCHART to produce clustered stacked bar chart using the following code. I want to show data labels (percentage of total as rounded without % sign) of individual components within a vertical bar along with letter grouping that is available in the dataset as an individual column with letters for each observation. The first issue I am not able to resolve is that what changes I need to make in the following code to make it rounded percentages without % sign. I have used Inside=subpct option. I am using 9.3 TS1M2.
Here is the code!
length group $15 midpoint $10 Labels $3;
retain xsys ysys '2' color 'black' when 'a';
/* Generate vertical bar chart */
goptions htext=1.6 htitle=2 Ftitle="Times New Roman" Ftext="Times New Roman";
/*ods listing image_dpi=450;
ods html close;
ods graphics /noborder imagefmt=jpeg ANTIALIASMAX=6300 ; */
Proc gchart data=DM;
vbar Cultivar / discrete noframe
raxis=axis1 maxis=axis2 gaxis=axis3 legend=legend1;
axis1 label=(a=90 f="Times New Roman" h=4pct "Dry matter (Mg/ha)" ) value=(f="Times New Roman" h=3pct) order=0 to 12 by 2 minor=none;
axis2 label=none value=(f="Times New Roman" h=2pct);
axis3 label=none value=(f="Times New Roman" h=2.7pct);
legend1 position=(top left inside) across=1 order= ("PL" "LL" "Head" "FL" "Stem") noframe label=none value=(f="Times New Roman" j=l) shape=bar(5,2);
Thanks for the help!
Message was edited by: Bhupinder Farmaha
08-14-2013 01:14 PM
It looks like part of your code has been dropped. You may want to paste into a pure text editor such as Notepad before copying and pasting here.
09-17-2013 09:33 AM
How are you creating the variable called 'labels' (that you use in the annotated text=labels)?
If you have a numeric variable that has percent values in it (such as foo=.20 for 20%), then you can set the annotated text as follows...
If you *do* want the % sign, then apply a percent format, something like:
If you do *not* want the % sign in the annotated text, then multiply by 100, something like ...