BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
lone0708
Fluorite | Level 6

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;

 

 

1 ACCEPTED SOLUTION
5 REPLIES 5
lone0708
Fluorite | Level 6

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?

 

lone0708_0-1661283909518.png

 

DanH_sas
SAS Super FREQ

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".

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
DanH_sas
SAS Super FREQ

@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;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

Register now!

How to Concatenate Values

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 790 views
  • 1 like
  • 4 in conversation