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

Hey all,

I'm creating effectplots via proc plm and I'd like to adjust the colors in the graph. My statement includes 'sliceby=a'. A is a class variable with 3 levels, I want to assign a color to each level and the lines in the graph to be displayed in that color.

No method to alter plots I know worked. Proc plm doesn't accept templates, further I tried to alter the 'Stat.PLM.Graphics.IntPlot' template. symbol1 color=.... doeesn't work either.

My SAS Version in use is 9.4 (TS1M2).

 

Anyone has an idea how to change the colors?

Thank you in advance!

 

ods graphics on; ods exclude Storeinfo classlevels;
   proc plm source=model1;
   effectplot interaction(x=time sliceby=a plotby=b)/ clm connect; run;
ods graphics off;

 

This is the model I store:

ods graphics on; ods exclude iterhistory  FitStatistics lsmeans diffs; 
	 proc mixed data=longr PLOTS(only)=PEARSONPANEL(conditional) covtest ; where a<4 and vessel=2 and t<>0; 
  class a id ide time vessel b;
      model particles = time a b time*a time*b a*b time*a*b/ ddfm=kr  residual ; 
	  random intercept / subject=ide(id)  type=un; repeated time/ subject=ide(id)  type=arh(1);
lsmeans time a b time*a time*b a*b time*a*b/diff ; ods output diffs=diffs1;  
store model1; run; ods graphics off;
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I can think of two ways. The first is to create your own style. I don't have much experience with that. The second way is to output the predicted values by using the OUTPM= option on the MODEL statement, then use PROC SGPLOT or PROC SGPANEL to create the graph.  Both procedures support the STYLEATTRS statement, which you can use to assign group colors, line patterns, and more. You'll need to sort by the X variable:

 

proc mixed data=longr; 
   class a time b;
   model particles = time a b time*a time*b a*b time*a*b/ ddfm=kr  residual outpm=mixedout; 
run;

proc sort data=mixedout; by b a time; run;

proc sgpanel data=mixedout;
styleattrs datacontrastcolors=(magenta blue gold);
panelby b;
scatter x=time y=Pred / yerrorlower=lower yerrorupper=upper group=a;
series x=time y=Pred / group=a;
rowaxis grid;
colaxis grid;
run;

View solution in original post

5 REPLIES 5
Rick_SAS
SAS Super FREQ

Please provide the procedure code that contains the STORE statement that generates the item store for the model.

Magdal3na
Fluorite | Level 6

Added it to the original post.

Rick_SAS
SAS Super FREQ

I can think of two ways. The first is to create your own style. I don't have much experience with that. The second way is to output the predicted values by using the OUTPM= option on the MODEL statement, then use PROC SGPLOT or PROC SGPANEL to create the graph.  Both procedures support the STYLEATTRS statement, which you can use to assign group colors, line patterns, and more. You'll need to sort by the X variable:

 

proc mixed data=longr; 
   class a time b;
   model particles = time a b time*a time*b a*b time*a*b/ ddfm=kr  residual outpm=mixedout; 
run;

proc sort data=mixedout; by b a time; run;

proc sgpanel data=mixedout;
styleattrs datacontrastcolors=(magenta blue gold);
panelby b;
scatter x=time y=Pred / yerrorlower=lower yerrorupper=upper group=a;
series x=time y=Pred / group=a;
rowaxis grid;
colaxis grid;
run;
Magdal3na
Fluorite | Level 6

Thanks a lot! By using the OUTPM= statement and proc sgpanel I can produce the interaction plots I wanna have.

Rick_SAS
SAS Super FREQ

For other tips regarding visualizing mixed models, see the article "Visualize a mixed model that has repeated measures or random coefficients."

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
  • 5 replies
  • 1686 views
  • 1 like
  • 2 in conversation