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;
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;
Please provide the procedure code that contains the STORE statement that generates the item store for the model.
Added it to the original post.
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;
Thanks a lot! By using the OUTPM= statement and proc sgpanel I can produce the interaction plots I wanna have.
For other tips regarding visualizing mixed models, see the article "Visualize a mixed model that has repeated measures or random coefficients."
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.