BookmarkSubscribeRSS Feed
Rcore
Calcite | Level 5

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!

 

3 REPLIES 3
PGStats
Opal | Level 21

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
Rcore
Calcite | Level 5

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!

 

 

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1599 views
  • 1 like
  • 2 in conversation