Programming the statistical procedures from SAS

Correlations with PROC MIANALYZE

Reply
New Contributor
Posts: 2

Correlations with PROC MIANALYZE

I am attempting to find the correlations of 8 variables from a data set of multiply imputed data. I'm fine creating the data set, however I do not understand the example for finding correlations with PROC MIANALYZE on the SAS site.

The syntax they provide is:

proc corr data=outmi out=outcorr;

var Oxygen RunTime;

by _Imputation_;

run;

proc print data=outcorr (obs=10);

title ’Correlations (First Two Imputations)’;

run;

data ztrans(type=EST);

set outcorr (drop= RunTime rename= Oxygen= Z);

if (_type_ = ’N’ or _name_ = ’RunTime’);

if (_type_ = ’CORR’) then do;

_type_= ’PARMS’;

_name_=’’;

Z= 0.5 * log((1+Z)/(1-Z));

end;

else if (_type_ = ’N’) then do;

_type_=’COVB’;

_name_=’Z’;

Z= 1. / (Z-3);

end;

run;

proc print data=ztrans;

title ’EST Type Data Set with Fisher’’s Z Transformation’;

run;

proc mianalyze data=ztrans;

ods output ParmEst=parms;

var z;

run;

set outcorr (drop= RunTime rename= Oxygen= Z);

if (_type_ = ’N’ or _name_ = ’RunTime’);

'Oxygen' and 'Runtime' are the only variables in the example data set. How would I re-write this syntax for a dataset with 8 variables? I cannot figure this out, and I can't run PROC MIANALYZE without first running this piece of syntax.

Has anyone dealt with this problem?

New Contributor
Posts: 2

Correlations with PROC MIANALYZE

Sorry--the formatting came out strange. It should have read:

I am attempting to find the correlations of 8 variables from a data set of multiply imputed data. I'm fine creating the data set, however I do not understand the example for finding correlations with PROC MIANALYZE on the SAS site.

The syntax they provide is:

proc corr data=outmi out=outcorr;

var Oxygen RunTime;

by _Imputation_;

run;

proc print data=outcorr (obs=10);

title ’Correlations (First Two Imputations)’;

run;

data ztrans(type=EST);

set outcorr (drop= RunTime rename= Oxygen= Z);

if (_type_ = ’N’ or _name_ = ’RunTime’);

if (_type_ = ’CORR’) then do;

_type_= ’PARMS’;

_name_=’’;

Z= 0.5 * log((1+Z)/(1-Z));

end;

else if (_type_ = ’N’) then do;

_type_=’COVB’;

_name_=’Z’;

Z= 1. / (Z-3);

end;

run;

proc print data=ztrans;

title ’EST Type Data Set with Fisher’’s Z Transformation’;

run;

proc mianalyze data=ztrans;

ods output ParmEst=parms;

var z;

run;

I do not understand the syntax following "data ztrans"--I understand that it is a Fisher's Z transformation, but I can't figure out how to write this for my data. Specifically, I do not understand the syntax:

set outcorr (drop= RunTime rename= Oxygen= Z);

if (_type_ = ’N’ or _name_ = ’RunTime’);

'Oxygen' and 'Runtime' are the only variables in the example data set. How would I re-write this syntax for a dataset with 8 variables? I cannot figure this out, and I can't run PROC MIANALYZE without first running this piece of syntax.

Has anyone dealt with this problem?

Ask a Question
Discussion stats
  • 1 reply
  • 130 views
  • 0 likes
  • 1 in conversation