BookmarkSubscribeRSS Feed
bchronister
Fluorite | Level 6

Hello, 

 

I have data that I am creating a Loess graph, that is categorized into two groups by cortisol median. I am trying to change the CLM colors from the default red and blue, and want them to match the color of the trendline and data points. I have identified how to change the CLM colors to the same color, but am not sure how to make them two different colors. Can anyone help? 

 

This is the code:

ods graphics on / width=6in;
ods graphics on / height=6in;


proc sgplot data=loess_data_ln aspect=1;
 Where rankcategory=175 & depanx=1  & hormone=1 & gender=0;
 LOESS Y=meanscore X=hormonemean_ln /group=cortisolmedian smooth=0.9 alpha=0.05  CLMattrs=(CLMFILLATTRS=(color=pink transparency=0.35)) degree=1 clm; 
 XAXIS grid label ="Testosterone, pg/mL" LABELATTRS=(family=arial size=12)min=2 max=5 valueattrs=(family=arial size=12pt) ; 
 YAXIS grid label="CDI-2 Mean Score" LABELATTRS=(family=arial size=12 ) valueattrs=( family=arial size=12pt) max=90  ;
 styleattrs datacontrastcolors=(VLIGB VIGB) datalinepatterns=(1)
 			datasymbols=(circlefilled) ;
 keylegend/ title=" " valueattrs=( family=arial size=12pt) ;
 format cortisolmedian cortisolmedianfmt. depanx depanxfmt. hormone hormonefmt.;
 title " " ;
	
run; 

SGPlot29.png 

2 REPLIES 2
Rick_SAS
SAS Super FREQ

use the DATACOLOR= option on the STYLEATTRS statement:

proc sgplot data=sashelp.iris;
 Where species in ("Setosa", "Virginica");
 styleattrs datacontrastcolors=(VLIGB VIGB)
            datacolors=(VLIG VIB) ;
 LOESS Y=SepalLength X=SepalWidth /group=Species smooth=0.9 alpha=0.05  
       CLMattrs=(CLMFILLATTRS=(transparency=0.35)) degree=1 clm; 
 XAXIS grid; 
 YAXIS grid;
run; 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1215 views
  • 0 likes
  • 2 in conversation