Hello all,
I am doing a survival curve using proc sgplot and the group statement. I have a total of 8 groups. I need some of the groups to have dotted lines and some of them to have full lines and specify every groups colour.
How to put it into the following code?
proc sgplot data=abc2;
series x=weeks y=SURVIVAL1 /group = exp_event;
run;
For full control of the attributes try a Discrete Attribute Map .
For full control of the attributes try a Discrete Attribute Map .
Thank you for your answer 🙂
I have tried to make the attribute map (please see attatched photo), but the colours are not at all corresponding. Do i miss something in the code?
The column names in an attributes map are reserved keywords, so they must be spelled as they are expected. In your screenshot, you have spelled the expected "fillcolor" with the alternate "fillcolour" spelling. Also, for a series plot, you should be using "linecolor" instead of "fillcolor".
You can use the STYLEATTRS command in PROC SGPLOT
Example
styleattrs datacontrastcolors=(orange cyan CXFF0000)
datalinepatterns=(dot solid longdash 26);
Experiment to find what works for you.
@PeterClemmensen is correct. You' will want to use an attributes map. Here is a simple example using a SERIES plot below:
data attrmap;
retain ID "myid" nocase "true";
input value $ linecolor $ linepattern $;
cards;
F pink solid
M blue dash
;
run;
proc sgplot data=sashelp.class dattrmap=attrmap;
series x=name y=weight / group=sex attrid=myid;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.