Hi there, I want to display uneven value in the axis using proc sgplot, but it looks like the VALUE statement does not work. My code is attached below. But the output plot only shows 0, 12, 36, and 60 in the axis.
proc sgplot data=cif1;
step x=months_to_scenario1 y=cif/group=study_id name="curve";
scatter x=months_to_scenario1 y=cenp / markerattrs=(symbol=plus) GROUP=study_id ;
text x=t1 y=s1 text=texc1/position=center textattrs=(size=10) outline;
xaxis offsetmin=0.015 offsetmax=0.015 max=60 values=(0 1 12 24 36 48 60);
yaxis max=0.25;
keylegend "curve";
run;
Thank you.
I can't see your data, so needless to say, this is untested. I think you just need to use the VALUESHINT Option in the xaxis Statement.
The tick at 1 likely does not appear as there is not enough space on the graph and that likely causes a note like this:
NOTE: Some of the tick values have been thinned.
And once the "thinning" process starts other values get removed.
Example that places irregular intervals:
proc sgplot data=sashelp.class; scatter x=height y=weight / markerattrs=(symbol=plus) GROUP=sex ; xaxis offsetmin=0.015 offsetmax=0.015 max=70 values=(40 47 53 62 70); run;
But if I add 41 to the values then not only does the 41 not appear but 47, 53 and 70 do not appear on the axis.
proc sgplot data=sashelp.class; scatter x=height y=weight / markerattrs=(symbol=plus) GROUP=sex ; xaxis offsetmin=0.015 offsetmax=0.015 max=70 values=(40 41 47 53 62 70); run;
With a range of 0 to 60 I am not quite sure what a tick mark at 1 tells you. If that is hypercritical then perhaps dropping 1 from the VALUES and adding a REFLINE at value 1 with an interesting label might be a good idea.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.