BookmarkSubscribeRSS Feed
Fluorite | Level 6
Hi all,

I cannot seem to figure out the code to create a combined correlation matrix from several imputed datasets.

I have used Proc Corr to output a datafile with the correlation matrices from 5 imputed datasets using the code below. However, I cannot seem to figure out the Proc Mianalyze code to output the combined matrix - the latter code just produces combined means and standard errors. Does anyone know how to combine and output the correlation matrix?

* output stacked dataset with correlation matrices for each imputed dataset;
proc corr data=temp out = outcorr;
var x1 x2 x3 x4 ;
by _imputation_;

*combine results using proc mianalyze;
proc mianalyze data=outcorr ;
modeleffects x1 x2 x3 x4;

Thank you for your time and any help you can offer!
Fluorite | Level 6
A member of SAS technical support provided me with an answer to this query. I am posting the code below in case this helps anyone else...

* Below is a sample program that shows how to get a combined correlation matrix using MIANALYZE ;

data FitMiss;
input Oxygen RunTime RunPulse @@;
44.609 11.37 178 45.313 10.07 185
54.297 8.65 156 59.571 . .
49.874 9.22 . 44.811 11.63 176
. 11.95 176 . 10.85 .
39.442 13.08 174 60.055 8.63 170
50.541 . . 37.388 14.03 186
44.754 11.12 176 47.273 . .
51.855 10.33 166 49.156 8.95 180
40.836 10.95 168 46.672 10.00 .
46.774 10.25 . 50.388 10.08 168
39.407 12.63 174 46.080 11.17 156
45.441 9.63 164 . 8.92 .
45.118 11.08 . 39.203 12.88 168
45.790 10.47 186 50.545 9.93 148
48.673 9.40 186 47.920 11.50 170
47.467 10.50 170

proc mi data=FitMiss seed=3237851 noprint out=outmi;
var Oxygen RunTime RunPulse x;

proc corr data=outmi fisher(biasadj=no);
var Oxygen RunTime runpulse x;
by _Imputation_;
ods output FisherPearsonCorr= outz;

data outz;
set outz;
StdZ= 1. / sqrt(NObs-3);
proc sort data=outz;
by pair _imputation_;

proc mianalyze data=outz;
by pair;
ods output ParameterEstimates=parms;
modeleffects ZVal;
stderr StdZ;
data corr_ci;
set parms;
label r='Correlation Coefficient';
r=tanh( Estimate);
proc print data=corr_ci label;
Calcite | Level 5

This is an amazing help. I am having the same issue but with polychoric correlation matrices.


I have 5 imputed datasets (outMI), and I have the following code to compute polychoric correlation matrices from the 5 imputed datasets (to create dataset polycorr_MI):

proc corr data=outMI outplc=polycorr_MI (TYPE=CORR);
var x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15;


Is there a similiar way to do this combination when you have polychoric and not pearson correlations?

Jade | Level 19

Hello @SandraG and welcome to the SAS Support Communities!


Only a few people will notice that you have replied to this almost ten year old thread. Notifications are sent to the participants of the old discussion, i.e., to only one person in this case -- whose last visit to the SAS Support Communities was in 2017 (according to jrbrauer's user profile). I suggest that you start a new thread, not in the SAS Procedures subforum, but under Statistical Procedures (use the orange "Start A Topic" button there). Then it'll be much more likely that one of the SAS/STAT experts will reply to your question. You can provide a link to jrbrauer's post as a reference:

Good luck!


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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1 like
  • 3 in conversation