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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.