I'm running this code in SAS:
* Series plot;
PROC SGPLOT DATA = UsGR;
SERIES X = Year Y = Overall_RBC /lineattrs =(color=red thickness =2pt);
SERIES X = Year Y = New/lineattrs =(color=blue thickness =2pt);
SERIES X = Year Y = Existing/lineattrs =(color=green thickness =2pt);
SERIES X = Year Y = Replace/lineattrs =(color=purple thickness =2pt);
XAXIS TYPE = Discrete labelattrs=(size=2);
XAXIS values =(1953 to 2016 by 2);
YAXIS LABEL = 'RBC Score';
title 'U.S. Decomposition';
RUN;
It gives me the graph I want however on the x-axis I want minor tick marks between the years (i.e 1953 (a tick mark for 1954) 1955 etc. Also I want all my xaxis years to be horizontal not slanted labels. I would also like to have textbox (legend) in the topleft if it can be done that looks like this:
Thanks!
Can you attach an example of what your graph looks like?
Setting TYPE-DISCRETE on the X axis will prevent you from displaying any axis minor tick values, as minor ticks are not applicable in that case.
If your "year" data is in date time format, remove the TYPE=DISCRETE and set INTERVAL=YEAR and MINOR.
If your "year" data is just a double column, remove the TYPE=DISCRETE and set INTEGER and MINOR.
Let me know if either of these work for you.
" I would also like to have textbox (legend) in the topleft if it can be done that looks like this".
This would be an INSET such as below:
proc sgplot data=sashelp.class; scatter x=height y=height; inset "Line 1 of inset text" "Line 2 of inset text" "Line 3 of inset text" /title='This is title for inset box' ; run;
You show a picture that I am too lazy to type. There are options to specify text appearance and location options. The default is upper left inside the graph area.
LEGENDS are something completely different and describe such things as line color/type or marker meanings.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: