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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1233 views
  • 2 likes
  • 2 in conversation