BookmarkSubscribeRSS Feed
Dreamer
Obsidian | Level 7

Hi,

In below graph you can see number labels are so congested. Also if number of digits gets more than 4 then it doesn't display at all.

I was wondering if there is a way to fix this. Can we increase space between bars?

4 REPLIES 4
ballardw
Super User

Code used to create the graph as the procedure, the output destination (HTML, RTF, PDF or other) AND which SAS version you are running has bearing on solutions.

Dreamer
Obsidian | Level 7

Hi

I'm creating Excel output by running following code in SAS 9.4:

options device=ACTXIMG nobyline;

goptions device=png rotate=landscape ;

ods graphics on;

ods excel

  options(sheet_interval='none' sheet_name='Graph Output' sheet_label=' ' suppress_bylines='yes'

    orientation='landscape' embedded_titles='yes' center_horizontal='yes'

    embedded_footnotes='yes')

  style=minimal ;

PATTERN1 COLOR=CX1F497D;

Axis1 STYLE=1 WIDTH=1 MINOR=(NUMBER=1) LABEL=(f="calibri/Bold" "Group Counts" ) value=(h=8pt) ;

Axis2 STYLE=1 WIDTH=1 LABEL=( f="calibri/Bold" "Enrollment Date CCYYMM" )value=(h=8pt);

TITLE underlin=2 "#byval(region)";

FOOTNOTE;

PROC GCHART DATA=REGIONGRPCNT ;

    BY region;

    VBAR ccyy /width=5 SUMVAR=grpcnt CLIPREF FRAME  DISCRETE TYPE=SUM space=3

SUM

    COUTLINE=GRAY

    RAXIS=AXIS1

    MAXIS=AXIS2

    LREF=1

    CREF=GRAY

    AUTOREF ;

RUN;

ods excel close;

ballardw
Super User

Sorry, I can't help much as I don't have 9.4 and our IT won't let us generate activex anything. If fitting on a printed page isn't quite an issue then increasing the setting of HSIZE in the goptions statement might help.

GraphGuy
Meteorite | Level 14

You would need to make the graph itself wider, in order for the bars to be wider.

I'm not sure about activex, but with device=png, you can use 'goptions xpixels=1000;' 

Once the page is wider, the gchart bars typically auto-size to fill up a 'comfortable' amount of the space, but you can further refine/control the bar width using the width= option.

 

Here's a small example:

 

goptions device=png xpixels=1000;

proc gchart data=sashelp.electric;
vbar year / discrete type=sum sumvar=revenue outside=sum width=8;
run;

 

foo.png

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 3858 views
  • 0 likes
  • 3 in conversation