Hi....I am trying to get the xaxis tickvalues rotated nothing seems to work that I have tried. I even tried re-formatting the values for the xaxis to shorten then in length in characters. Right now the values are displayed at a 45 degrees and I would like them to be at 90 degrees. Any suggestions....thanks.
proc sgplot data=want21;
series x=Term y=Retention / lineattrs=(color=blue thickness=2);
series x=Term y=Persistence / lineattrs=(color=red thickness=2);
xaxis type=discrete fitpolicy=rotate valuesrotate=vertical;
xaxis label='Year-Term' valueattrs=(size=7pt) labelattrs=(size=12pt weight=bold) ;
yaxis label='Percentage' values=(0.5 to 1 by .1) valueattrs=(size=10pt) labelattrs=(size=12pt weight=bold);
run;
quit;
Use VALUESROTATE=VERTICAL on the XAXIS statement.
You need to use ROTATEALWAYS instead of ROTATE for your fit policy to you want them to rotate when there is no collision.
Hi DanH…..I changed the fitpolicy to RotateAlways and received a warning.
50 proc sgplot data=want21;
51 series x=Term y=Retention / lineattrs=(color=blue thickness=2);
52 series x=Term y=Persistence / lineattrs=(color=red thickness=2);
53 xaxis type=discrete fitpolicy=rotatealways valuesrotate=vertical;
____________
1
WARNING 1-322: Assuming the symbol ROTATE was misspelled as rotatealways.
54 xaxis label='Year-Term' valueattrs=(size=7pt) labelattrs=(size=12pt weight=bold) ;
55 yaxis label='Percentage' values=(0.5 to 1 by .1) valueattrs=(size=10pt) labelattrs=(size=12pt weight=bold);
56 run;
Sorry, it's available in GTL but COMING in the SG procedures. In the meantime, you can use TMPLOUT on the SGPLOT statement to dump out a GTL template, change ROTATE to ROATATEALWAYS on the fit policy, and render the template using PROC SGRENDER.
Hope this helps!
Dan
You can use
VALUESROTATE=vertical
in the XAXIS Statement as explained in the blog post Axis values display at the Graphically Speaking blog.
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.