Hi
In my graph I need to display Y axis -8 to 8 by 2 but need horizontal grid lines -8 to 8 by 1 with no label.
Any ideas?
Thanks
One "simplistic" way is to set y-axis values=(-8 to 8 by 2) with grid option. Then add y reflines at the other places and set the refline attributes to the same as the grid lines.
refline -7 -5 -3 -1 1 3 5 7 / lineattrs=graphgridlines;
or, just draw the reflines for all values, or from a column that has these values as observations.
proc sgplot data=sashelp.class;
scatter x=height y=weight;
yaxis values=(0 to 200 by 40) grid;
refline 20 60 100 140 180 / lineattrs=graphgridlines;
run;
I want to add to Sanjay's example by mentioning that you can use the SEQUENCE notation on the REFLINE statement as well:
refline (-7 to 7 by 2) / lineattrs=graphgridlines;
or
refline (20 to 180 by 40) / lineattrs=graphgridlines;
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 save with the early bird rate—just $795!
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.