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
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.)
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.)
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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.