- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a datasets that contains over 220 variables (include dummies that represents nominal). however, I would like to create a table that highlights highly correlated data (with |correlation| >60%) only.
as an example, if I ran the following code:
data have;input v1-v7;cards;1 4 5 33 6 1 09 11 32 5 4 1 00 4 5 4 77 0 01 2 9 9 5 1 1;run;proc corr data = have OUTP= corr;var v1-v7;run;
if I ran the code above I'll get
what I'm trying to generate is the following table:
VARIABLE1 | VARIABLE2 | CORR |
V1 | V2 | 0.95 |
V1 | V3 | 0.99 |
V2 | V3 | 0.92 |
V5 | V6 | -0.99 |
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Create a list, which only has abs(correlations) above a certain cutoff.
EXAMPLE
proc corr data=sashelp.class noprob nosimple;
var age height weight;
ods output pearsoncorr=corrs;
run;
data want;
set corrs;
length variable2 $ 32;
array r _numeric_;
do j=_n_+1 to dim(r);
corr=r(j);
variable2=vname(r(j));
if abs(corr)>0.6 then output;
end;
keep variable corr variable2;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SORRY i DON'T KNOW WHY THE SAS CODE switched to this form:
here it is again:
data have;
input v1-v7;
cards;
1 4 5 33 6 1 0
9 11 32 5 4 1 0
0 4 5 4 77 0 0
1 2 9 9 5 1 1
;
run;
proc corr data = have OUTP= corr;
var v1-v7;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Create a list, which only has abs(correlations) above a certain cutoff.
EXAMPLE
proc corr data=sashelp.class noprob nosimple;
var age height weight;
ods output pearsoncorr=corrs;
run;
data want;
set corrs;
length variable2 $ 32;
array r _numeric_;
do j=_n_+1 to dim(r);
corr=r(j);
variable2=vname(r(j));
if abs(corr)>0.6 then output;
end;
keep variable corr variable2;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There are many function that I have never used before here. Thank you very much. I learned a lot from your code
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
that is a great way of visualizing the output. I really appreciate your input.
thanks