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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.