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; 

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
  • 936 views
  • 0 likes
  • 2 in conversation