Question

I am trying to make a data set that has the p-values (or alpha values) along with the Pearson correlation coefficient for different variables.

I have about 6000 variables, and 4 variables I am correlating them with. I obtained the coefficients by using the output statement below

Full Code:

proc corr data=dat   outp = corr   noprint;
 var v1
     v2
     v3
     v4;
 with 
     v1
     v2
     v3
     v4
     v5
     ...;               *upto about v6000;
 run;

However, I would also like the alpha values that I usually get in the 'Results Viewer' window, as a data set.

Thank you.

Was it helpful?

Solution

Try the following:

*Get corrs;
proc corr data=test outp=Corr;
    var v1-v4;
    with v:;
run;

*Get Alphas;
ods output CronbachAlpha=Alpha;
proc corr data=test alpha nocorr;
    var v:;
run;
ods output close;

*Merge and Format;
data out(drop=Variables Alpha);
    set Alpha Corr;
    if Variables^='' then do;
        _TYPE_='Alpha';
        _NAME_=Variables;
         v1=alpha;
        v2=alpha;
        v3=alpha;
        v4=alpha;
    end;
run;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top