Hello, I am trying to figure out how to generate plots from mixed-effects models from SAS. I am interested to see whether group show statistical differences on outcomes (measured at t0 and t2) at different time points (t0 and t2). Specifically, I am looking for a plot similar to ggeffects in R with predicted means, values between these two groups. Please see the SAS codes below for the mixed-effect models. I tried several codes online (e.g., effect plot in the PROC PLM) but unable to generate the plots. Ideally, the plot will show timepoints at x-axis, pi/pdi at y-axis (they are the same measurement related at two points), and different lines representing two groups (variable BRIGHT). DATA Mixed1;
SET anova_analysis2023;
ARRAY A1{*} pit0 pdit2;
DO TMP = 1 to 2;
TMPV = VNAME(A1{TMP});
AVAL = A1{TMP};
OUTPUT;
END;
RUN;
PROC MIXED DATA = Mixed1;
CLASS ID TMP(ref="1") BRIGHT(ref="0") POC/*IF CATEGORICAL COVARIATES ADD HERE*/;
MODEL AVAL = TMP|BRIGHT POC other_op_inlife_t0/*IF CONTINUOUS COVARIATES HERE*/ / S E1 E2;
REPEATED TMP / SUBJECT = ID TYPE = UN RCORR;
LSMEANS TMP TMP*BRIGHT / CL DIFFS;
TITLE1 “Mixed Model (Interaction) between group (BRIGHT) and Time”;
RUN; Some of the codes I have tested are as follows. Maybe I need to combine pit0 and pdit2 into one variable? Thanks for any advice. proc plm restore=PIPDIModel; /* use item store to create fit plots */
effectplot fit(x=TMP plotby=BRIGHT); /* panel */
effectplot slicefit(x=TMP sliceby=BRIGHT); /* overlay */
run;
proc sgplot data=Mixed1;
scatter x=TMP y=AVAL / group=BRIGHT;
series x=TMP y=AVAL / groupLC=BRIGHT curvelabel;
legenditem type=line name="E" / label="Experiment" lineattrs=GraphData1;
legenditem type=line name="C" / label="Control" lineattrs=GraphData2(pattern=dash);
keylegend "E" "C";
run;
... View more