turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Hierarchical clustering using distance = "spearman...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-07-2016 04:13 PM

In PROC CLUSTER or any other procedure, can I choose a distance method as a Spearman's correlation coefficient between variables?

If so, what is the option name?

Thank you very much for your help!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-07-2016 04:52 PM

Correlations are proximity measures, not distance. You have to create your own distances from Spearman correlations as SQRT(1-S) and use them for clustering:

```
proc corr data=sashelp.class outs=os noprint;
var height weight age;
run;
data osd(type="DISTANCE");
set os;
where _TYPE_ = "CORR";
array d _NUMERIC_;
do i = 1 to dim(d);
d{i} = sqrt(1 - d{i});
end;
rename _NAME_ = ID;
drop _TYPE_ i;
run;
proc cluster data=osd method=flexible out=osdc;
id ID;
run;
```

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-08-2016 01:00 PM

Thank you very much for your kind response. Why did you choose "method=flexible" in proc cluster? Is this because the distance is based on correlation coefficients?

I've checked SAS User's Guid, but couldn't figure out.

I really appreciate your help!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-08-2016 02:48 PM

Clustering is most often done among observations, not variables. Proc VARCLUS is the only SAS procedure for clustering variables but does not allow for user-defined distance measures. The method proposed is for clustering variables based on Spearman correlations with proc CLUSTER, a procedure which requires distances.

I have suggested PROC CLUSTER METHOD=FLEXIBLE because it has given me useful results for similar problems. That doesn't prevent you from exploring other options at your will. No clustering method is universally the best. I'd be interested to know what method you chose in the end.

PG