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

 

The code below works fine, however, I would like the lines in each panel to be a different color. Do I need to annotate to get that result?

GRX is a formatted numeric value and has four levels (one panel for each value of GRX).

Pressure is an integer values ranging from zero to a maximum of around 30. Each value if ID is a time series for a different set of measurements.

 
    proc sgpanel data= plot noautolegend ;
      panelby trt  / rows=2 columns=2 sort=(ascending ) headerattrs = (size = 7pt family = "Courier New");
      styleattrs datasymbols=(CircleFilled) datacontrastcolors=(black)  datalinepatterns=(solid);
       rowaxis  VALUES= (0 to 40 by 2)  grid  GRIDATTRS=(color=ltgray pattern=solid)
        labelattrs = (size = 7pt family = "Courier New") valueattrs = (size = 7pt family = "Courier New")
        label = "Pressure";
 
        colaxis  VALUES= (0 1 3 6 9 12 13 15) VALUESHINT grid  GRIDATTRS=(color=ltgray pattern=solid)
        labelattrs = (size = 7pt family = "Courier New") valueattrs = (size = 7pt family = "Courier New");
 
      series  x= MONTH y= pressure / group=id lineattrs=(thickness=1)  ;
      scatter x= MONTH y=pressure / group=id markerattrs=(size=6pt) ;
    run;
 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

First you will want to combine the SCATTER and SERIES statements:

series  x= MONTH y= pressure / group=id lineattrs=(thickness=1)  markers markerattrs=(size=6pt);

 

If you want all of the lines in each cell to be same color, add GROUPLC=trt (the PANELBY variable) to the SERIES statement. If you want each line in the panel to have a unique color, create a new variable with unique values (e.g. 1, 2, 3, etc.) and assign it to the GROUPLC option.

 

Hope this helps!

 

View solution in original post

3 REPLIES 3
DanH_sas
SAS Super FREQ

First you will want to combine the SCATTER and SERIES statements:

series  x= MONTH y= pressure / group=id lineattrs=(thickness=1)  markers markerattrs=(size=6pt);

 

If you want all of the lines in each cell to be same color, add GROUPLC=trt (the PANELBY variable) to the SERIES statement. If you want each line in the panel to have a unique color, create a new variable with unique values (e.g. 1, 2, 3, etc.) and assign it to the GROUPLC option.

 

Hope this helps!

 

_Hopper
Obsidian | Level 7

This helps but the colors are not quite correct. The line colors are fine (I want alternating blue and green in each panel) however, the markers are mixed in each panel. Most match the line colors but some do not.

 

What am I missing?

_Hopper
Obsidian | Level 7
I got it - GROUPMC option. Thanks!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 546 views
  • 3 likes
  • 2 in conversation