## Bray Curtis Dissimilarity

Hi!
I am trying to calculate Bray Curtis Dissimilarity in SAS by proc distance.

I found an example on the next page:https://www.statisticshowto.datasciencecentral.com/bray-curtis-dissimilarity/

According to the Formula, the result must be 0.39
The same numbers I am getting in the R vegan.

Proc distance producing different results.

```data c;
infile datalines;
input id \$ A1 A2 A3 ;
datalines;
Fish_1 6 7 4
Fish_2 10 0 6
;
run;
proc distance data=c method=blwnm;
var ANOMINAL( A: ) ;
id id;
run;```

Results:

 id Fish_1 Fish_2 Fish_1 0 Fish_2 0,6 0

What am I doing wrong here?

Thanks,
Andrii

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Bray Curtis Dissimilarity

Hi @andrii and welcome to the SAS Support Communities!

Thanks for this interesting question. I didn't know this specific dissimilarity measure.

In the PROC DISTANCE documentation (close to the bottom of that page) I found that the formula SAS uses with method=blwnm is not equivalent to your linked formula. However, SAS provides an equivalent formula with method=nonmetric. Actually, the formula looks different, but it's an easy exercise to show that it's equivalent (hint: abs(x-y)=x+y-2*min(x,y)).

So, in order to replicate your result, use this code:

``````proc distance data=c out=want method=nonmetric;
var ratio(a:);
id id;
run;``````

(Note that level "ratio" is required for method=nonmetric.)

2 REPLIES 2

## Re: Bray Curtis Dissimilarity

Hi @andrii and welcome to the SAS Support Communities!

Thanks for this interesting question. I didn't know this specific dissimilarity measure.

In the PROC DISTANCE documentation (close to the bottom of that page) I found that the formula SAS uses with method=blwnm is not equivalent to your linked formula. However, SAS provides an equivalent formula with method=nonmetric. Actually, the formula looks different, but it's an easy exercise to show that it's equivalent (hint: abs(x-y)=x+y-2*min(x,y)).

So, in order to replicate your result, use this code:

``````proc distance data=c out=want method=nonmetric;
var ratio(a:);
id id;
run;``````

(Note that level "ratio" is required for method=nonmetric.)

## Re: Bray Curtis Dissimilarity

Hi @FreelanceReinh

Yes, it exactly what I have been looking for!

Thanks a lot!

Discussion stats
• 2 replies
• 974 views
• 1 like
• 2 in conversation