BookmarkSubscribeRSS Feed
Shad
Obsidian | Level 7

Hello,

 

I'm struggling to figure out how to combine LSMEANS differences from an analysis following multiple imputations. I think I have the right ODS OUTPUT statements to get the estimates but I'm not quite sure how to combine them using PROC MIANALYZE. I'm attempting to get the differences (comparisons) for the interaction term toradol*ibu along with the OR and 95% CLs. 

 

PROC GLIMMIX DATA=mi_xfer_analysis METHOD=RSPL NOCLPRINT;
	BY _imputation_; 
	CLASS hospital_number  toradol (ref='0') insurance (ref = '0') sex  ethnicity (ref = '2') race (ref = '1') region (ref = '3') open_surgery (ref='0')  ibu (ref='0');
	MODEL b_xfer30 (EVENT='1') = toradol ibu toradol*ibu sex race ethnicity insurance age_at_surgery year_of_surgery open_surgery region  / CL DIST=BINARY LINK=LOGIT SOLUTION
	ODDSRATIO (DIFF=FIRST LABEL);
	RANDOM RESIDUAL;
	RANDOM INTERCEPT / SUBJECT=hospital_number TYPE=VC SOLUTION CL g;

LSMEANS toradol ibu toradol*ibu / diff oddsratio cl;
ods output parameterestimates=parms3 solutionr=rand_parms3;
ods output lsmeans=lsmeans_ds;
ods output diffs=diff;
RUN;

I tried adapting some code from a simple PROC MIXED example, however I'm interested in the interaction differences. 

 

 
*Example code that needs to be adjusted to work. 

proc sort data=lsmeans_ds;
      by toradol ibu _imputation_;
      run;
   proc mianalyze data=lsmeans_ds;
      by toradol ibu;
      modeleffects estimate;
      stderr stderr;
      run;

data diff2;
      set diff;
      comparison=toradol*ibu||' vs '||left(_toradol _ibu);
      run;
   
   proc sort data=diff2;
      by comparison _imputation_;
      run;
   
   proc mianalyze data=diff2;
      by comparison;
      modeleffects estimate;
      stderr stderr;
      run;

Hopefully I've provided enough details but let me know if any additional info would be helpful. 

 

Thanks. 

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

Moved to STAT forum in the hope you'll get an answer there.

SAS_Rob
SAS Employee

You were on the right track, but you will need to set up the COMPARISON variable in the data set differently.  Here is an example you can follow as a template.

 

data outmi;
do _imputation_=1 to 3;
do trt='test','trt1','trt2';
do b=1 to 3;
do rep=1 to 10;
trtn+1;
y=1.3+.86*trtn+b*trtn+rannor(123);
output;
end; end; end;end;
run;

proc glimmix data=outmi;
by _imputation_;
class trt b;
model y=trt|b;
lsmeans trt|b/diff;
ods output diffs=lsmeans_diffs;
run;
data diff2;
set lsmeans_diffs;
comparison=trt||''||trim(left(b))||' vs '||left(_trt)||''||left(_b);
run;
proc sort data=diff2;
by comparison _imputation_;
run;

proc mianalyze data=diff2;
by comparison;
modeleffects estimate;
stderr stderr;
run;

 

SteveDenham
Jade | Level 19

@SAS_Rob 

 

That is sweet! I have spent years (literally) trying to figure out how to get MIANALYZE to handle mixed model stuff.  The answer is to get the results in which you are interested _by_ IMPUTATION in an ODS dataset, and then combine those.  It eliminates the transfer of covariance matrices which I never get right.  This is going to really help analysis of repeated measures where data are MNAR.

 

SteveDenham

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!
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
  • 3 replies
  • 809 views
  • 2 likes
  • 4 in conversation