BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AntjeWestphal
Obsidian | Level 7

Hi Community!

I'd like to have the grid at the white spaces between the bars. How can I achieve that?

Here is my code and the result as PDF:

options papersize=(42cm 29.7cm);
ods graphics on / width=40cm height=28cm attrpriority=none;
options nodate nonumber orientation=landscape topmargin="1cm" center;
ods html close;
ods pdf file='Y:\...\Test.pdf';
PROC SGPLOT DATA = dataset;
xaxis display=(noticks) grid;
yaxis values=(0 to 4 by 0.5) offsetmin=0 valueattrs=(size=17);
styleattrs datacolors=(STLG BIGB STYPK LIBGR);
   vbar Lab / response=Wert group=Gr groupdisplay=cluster nooutline;
keylegend / noborder autooutline titleattrs=(size=15) valueattrs=(size=15);
run;
ods pdf close;
ods html;

Best regards

Antje

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @AntjeWestphal,

 

You can remove the GRID option from the XAXIS statement and create the new grid lines as reference lines instead (using the grid lines' style):

refline Lab / axis=x discreteoffset=-0.5 lineattrs=GraphGridLines;
refline Lab / axis=x discreteoffset= 0.5 lineattrs=GraphGridLines;

Actually either of the two statements above is sufficient to draw the grid lines between the groups of bars -- plus one to the left of the first group or one to the right of the last group, respectively. (To hide that possibly unwanted additional line, you could draw a white reference line over it.)

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @AntjeWestphal,

 

You can remove the GRID option from the XAXIS statement and create the new grid lines as reference lines instead (using the grid lines' style):

refline Lab / axis=x discreteoffset=-0.5 lineattrs=GraphGridLines;
refline Lab / axis=x discreteoffset= 0.5 lineattrs=GraphGridLines;

Actually either of the two statements above is sufficient to draw the grid lines between the groups of bars -- plus one to the left of the first group or one to the right of the last group, respectively. (To hide that possibly unwanted additional line, you could draw a white reference line over it.)

AntjeWestphal
Obsidian | Level 7

Dear FreelanceReinhard,

 

thanks a lot! I tried around a bit and that works perfect:

refline Lab / axis=x discreteoffset=-0.5 lineattrs=(color=darkgrey);
refline Lab / axis=x discreteoffset= 0.5 lineattrs=(color=darkgrey);
refline Lab / axis=x discreteoffset= 0.0 lineattrs=(color=white);

 

Best regards and a guten Rutsch! 🎉🍀😁

Antje

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 384 views
  • 2 likes
  • 2 in conversation