Solved
Contributor
Posts: 41

# Spaghetti plot with different markers

I am trying to create a spaghetti plot using PROC SGPLOT.

I am using Subject ID as the group variable. I want to display

different markers for each subjects. In the current plot all the subjects have

same markers. I would different markers. How can this be achieved ?

Here is the very simple starting code...

proc sgplot data = lab ;
series x = weeks y = lbstresn / markerattrs =(symbol=circlefilled )group = subjid ;
yaxis type = log logstyle = logexpand display = all;
xaxis values= (0 to 30 by 1 );
run;

Accepted Solutions
Solution
‎08-16-2016 05:51 PM
SAS Super FREQ
Posts: 3,907

## Re: Spaghetti plot with different markers

What version of SAS are you running?  In SAS 9.4m2 you can use the GROUPLC=, GROUPLP=, GROUPMC=, and GROUPMS= options to specify the colors and patterns of lines and the colors and symbols of markers, respectively.

For your example, I think you can write:

series x=weeks y=lbsresn / group=subjid groupms=subjid markers;

Of course, if you have more than about 20 subjects, you will run out of markers.

For more on spaghetti plots in SAS see

Create spaghetti plots with SGPLOT

More on spaghetti plots

All Replies
Solution
‎08-16-2016 05:51 PM
SAS Super FREQ
Posts: 3,907

## Re: Spaghetti plot with different markers

What version of SAS are you running?  In SAS 9.4m2 you can use the GROUPLC=, GROUPLP=, GROUPMC=, and GROUPMS= options to specify the colors and patterns of lines and the colors and symbols of markers, respectively.

For your example, I think you can write:

series x=weeks y=lbsresn / group=subjid groupms=subjid markers;

Of course, if you have more than about 20 subjects, you will run out of markers.

For more on spaghetti plots in SAS see

Create spaghetti plots with SGPLOT

More on spaghetti plots

Contributor
Posts: 41

## Re: Spaghetti plot with different markers

Thank you. GROUPMC options works.

SAS Super FREQ
Posts: 3,907

## Re: Spaghetti plot with different markers

Great! Just to be clear, GROUPMC= changes the color. GROUPMS= changes the symbol.

☑ This topic is solved.