BookmarkSubscribeRSS Feed
Eva
Quartz | Level 8 Eva
Quartz | Level 8
Dear all,

I have a proc gchart with g100 where I display the percentage of each bar on top of it. This works fine in HTML but not in PDF. In PDF the percentage on top of the bars is simply missing.

Here's my code:

proc gchart data=work.mydata;
vbar myfield1 / group=mygroupfield type=percent percent g100 freq=myfield2;
run;


Best regards
Eva
2 REPLIES 2
GraphGuy
Meteorite | Level 14
I suspect that the pdf is generating the bars a little narrower than your html plot, and there is not enough room for the labels. Are you seeing a "Warning" in your log, such as ...

WARNING: The VBAR/VBAR3D chart for myfield1 could not be labeled because the labels are wider than the bars.

I don't have your data, but I created some mock-up data, and I was able to reproduce the problem (and a fix). The code below seems to work ok, once I added the "width=12" for the bars (depending on how many bars you have, etc, you might have to adjust the width to suit your data)...

-----

%let name=plt038;

data mydata;
input mygroupfield $ 1-6 myfield1 $ 8 myfield2;
datalines;
Group1 a 5
Group1 b 7
Group2 a 6
Group2 b 7
run;


GOPTIONS DEVICE=pdf;
options nodate nonumber;

ODS LISTING CLOSE;
ODS pdf file="&name..pdf" startpage=no;

proc gchart data=mydata;
vbar myfield1 / group=mygroupfield type=percent percent g100 freq=myfield2 width=12;
run;

quit;
ODS PDF CLOSE;
ODS LISTING; Message was edited by: Robert Allison @ SAS
Eva
Quartz | Level 8 Eva
Quartz | Level 8
Dear Robert Allison,

from tho look of it it could be that the bars are too narrow. I tried applying width but it didn't work until I used

options papersize=a3;

as well. There was simply not enough room for the graph.

Seem like most pdf problems are solved with width and the like...

Eva

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 1604 views
  • 0 likes
  • 2 in conversation