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

Hi All,

 

I am trying to generate a figure plot using the below code. I am getting the output as in the attached screen shot.


proc sgpanel data=have  ;
panelby SUBJID / layout=PANEL novarname columns=4 rows=2;
series x=x_axis_var y=aval /group=trt01p_  lineattrs=(pattern=mediumdash thickness=2);
scatter x=x_axis_var y=aval /group=trt01p_ markerattrs = (symbol=circlefilled size=8);

rowaxis integer grid values=(0,50,75,100) label="test";
colaxis integer grid values=(1 to 10 by 1) discreteorder=data label="Day";

run;
quit;

 

My query is how can we change the Blue color plots 'Green', Red color plots to 'Blue' and the bottom Legend with Green and Blue colors?

csa_0-1624383627203.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The colors and order by default come from the current style you have.

You can override the order and colors with a STYLEATTRS statement.

Since you are using lines and markers the specific element you want  to override is the DATACONTRASTCOLORS.

 

Try adding:

styleattrs datacontrastcolors=(green blue);

 

The first group value encountered should get green lines and markers and the second would be blue. If the order isn't as desired then switch them in the statement. Note that the third or other group values will still have the default colors.

 

If you want to modify the colors slightly you can use words like bright, dark, light (and a few more) such as darkgreen brightblue.

Or investigate all of the color naming schemes SAS uses.

View solution in original post

2 REPLIES 2
ballardw
Super User

The colors and order by default come from the current style you have.

You can override the order and colors with a STYLEATTRS statement.

Since you are using lines and markers the specific element you want  to override is the DATACONTRASTCOLORS.

 

Try adding:

styleattrs datacontrastcolors=(green blue);

 

The first group value encountered should get green lines and markers and the second would be blue. If the order isn't as desired then switch them in the statement. Note that the third or other group values will still have the default colors.

 

If you want to modify the colors slightly you can use words like bright, dark, light (and a few more) such as darkgreen brightblue.

Or investigate all of the color naming schemes SAS uses.

csa
Fluorite | Level 6 csa
Fluorite | Level 6
Thanks

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1194 views
  • 1 like
  • 2 in conversation