
HAMMING DISTANCEName:
This command takes two numeric variables of equal length. It returns the number of elements in the two variables that are different (i.e., X(1) is compared to Y(1), X(2) is compared to Y(2), and so on). Often these two variables will consist of a sequence of 1's and 0's, but this command is not restricted to that case. The STRING HAMMING DISTANCE can be used to compute the Hamming distance of two strings.
<SUBSET/EXCEPT/FOR qualification> where <y1> is the first response variable; <y2> is the second response variable; <par> is a parameter where the computed Hamming distance is stored; and where the <SUBSET/EXCEPT/FOR qualification> is optional.
LET A = HAMMING DISTANCE Y1 Y2 SUBSET Y1 > 0 SUBSET Y2 > 0
LET Y1 = DATA 1 1 0 0 LET Y2 = DATA 1 0 1 0 LET DIST = HAMMING DISTANCE Y1 Y2 SET WRITE DECIMALS 0 PRINT DISTThe following output is returned PARAMETERS AND CONSTANTS DIST  2  
Privacy
Policy/Security Notice
NIST is an agency of the U.S. Commerce Department.
Date created: 10/16/2018 