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

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. Capture.PNG

 

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

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;

View solution in original post

4 REPLIES 4
SAS_Rob
SAS Employee

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;

changisme
Calcite | Level 5

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?

Capture.PNGCapture.PNG

SAS_Rob
SAS Employee

Try running it without the CLASS statement like I did and see if that helps.

changisme
Calcite | Level 5

That worked perfectly. Thanks a bunch! Why is that? Does class statement change the variable somehow?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 864 views
  • 2 likes
  • 2 in conversation