Hi all,
I am using the proc mixed estimate statements to estimate the mean difference in slopes, i.e. treatment arm x time interaction, and I am using the follow ods dataset.
Then I'm trying to use proc mianalyze for it, but I cannot seem to get modeleffects to work when putting "label" or the actual variable names in there. Could someone help me understand how to use proc mianalyze for something like this?
Thanks.
The key is not to use spaces in the labeling of the ESTIMATE statements since those ultimately will be the variables you place on the MODELEFFECTS statement. Below is a simple example you can follow and apply in your case.
data test;
do a=1 to 3;
do rep=1 to 10;
x=ranuni(123)*10;
if ranuni(234)>.55 then y=.;
else y=.46+.88*a+x+rannor(123);
output;
end;
end;
proc mi data=test out=outmi;
var a x y;
run;
ods trace on;
proc mixed data=outmi;
by _imputation_;
class a;
model y=a x;
estimate 'A1_v_A2' a 1 -1 0;*do not use spaces in the labels;
estimate 'A1_v_A3' a 1 0 -1;
ods output estimates=estimate_ds(rename=(label=effect));
run;
proc mianalyze parms=estimate_ds;
modeleffects A1_v_A2 A1_v_A3;*these are the labels you used;
run;
The key is not to use spaces in the labeling of the ESTIMATE statements since those ultimately will be the variables you place on the MODELEFFECTS statement. Below is a simple example you can follow and apply in your case.
data test;
do a=1 to 3;
do rep=1 to 10;
x=ranuni(123)*10;
if ranuni(234)>.55 then y=.;
else y=.46+.88*a+x+rannor(123);
output;
end;
end;
proc mi data=test out=outmi;
var a x y;
run;
ods trace on;
proc mixed data=outmi;
by _imputation_;
class a;
model y=a x;
estimate 'A1_v_A2' a 1 -1 0;*do not use spaces in the labels;
estimate 'A1_v_A3' a 1 0 -1;
ods output estimates=estimate_ds(rename=(label=effect));
run;
proc mianalyze parms=estimate_ds;
modeleffects A1_v_A2 A1_v_A3;*these are the labels you used;
run;
Hi Rob,
That's very helpful, but I'm getting some odd errors. When I included all the pairwise comparisons, it says sas is out of memories, even if I subset the imputation dataset to just 2 imputations. If I only ask for 1 of the effects, it says the effect is not in the dataset, even though it is in there for sure. I was able to successfully run your example, and I can't see how mine is different... Any clues?
Try running it without the CLASS statement like I did and see if that helps.
That worked perfectly. Thanks a bunch! Why is that? Does class statement change the variable somehow?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.