- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am doing a Proc Corr on a data set But I only want to output the correlations of variables that have absolute correlations higher than 0.7.
I am using SAS Studio this is my code.
ods noproctitle;
ods graphics / imagemap=on;
proc corr data=_TEMP0.BODYFAT2 pearson nosimple noprob rank outp=work.Corr_stats12;
var Age Weight Height Neck Chest Abdomen Hip Thigh Knee Ankle Biceps Forearm Wrist;
with Age Weight Height Neck Chest Abdomen Hip Thigh Knee Ankle Biceps Forearm Wrist;
run;
I tried using the best and rank statement but they aren't really helping me.
Thank you in advance
- Tags:
- correlation
- proc corr
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Avdol and welcome to the SAS Support Communities!
If your primary focus is on the printed output (as this is what the options BEST= and RANK only address), you can define and use a numeric format to suppress any low correlation coefficients:
proc format;
value corr07f
-0.7-0.7 = ' '
other = [8.5];
run;
ods select none;
ods output pearsoncorr=pc;
proc corr data=_TEMP0.BODYFAT2 noprob;
var Age Weight Height Neck Chest Abdomen Hip Thigh Knee Ankle Biceps Forearm Wrist;
run;
ods select all;
proc print data=pc noobs;
format _numeric_ corr07f.;
run;
Maybe you would like to suppress the trivial "1.00000" values on the main diagonal of the correlation matrix as well (provided that you can rule out [almost] perfect correlations elsewhere!). Then just include 1 in the range specification of the format definition:
-0.7-0.7, 1 = ' '
(Edit: simplified format definition.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You could use the BEST= option to get a data set with the top correlations, and then delete any correlations that are <0.7
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have tried using the rank function but how do I delete the correlations?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Avdol and welcome to the SAS Support Communities!
If your primary focus is on the printed output (as this is what the options BEST= and RANK only address), you can define and use a numeric format to suppress any low correlation coefficients:
proc format;
value corr07f
-0.7-0.7 = ' '
other = [8.5];
run;
ods select none;
ods output pearsoncorr=pc;
proc corr data=_TEMP0.BODYFAT2 noprob;
var Age Weight Height Neck Chest Abdomen Hip Thigh Knee Ankle Biceps Forearm Wrist;
run;
ods select all;
proc print data=pc noobs;
format _numeric_ corr07f.;
run;
Maybe you would like to suppress the trivial "1.00000" values on the main diagonal of the correlation matrix as well (provided that you can rule out [almost] perfect correlations elsewhere!). Then just include 1 in the range specification of the format definition:
-0.7-0.7, 1 = ' '
(Edit: simplified format definition.)