*! version November 14, 2016 @ 18:17:52

Title

sqstrmerge -- Merge files using closest matches according to Levenshtein

Syntax

sqstrmerge
{1:1|m:1|1:m}
varlist

, max(#)
[
options
]

sqom-options
indelcost(#) set indel costs to #

subcost(#|implied formula|matexp|matname) specify substitution costs

standard(#|cut|longer|longest|none) standardization of sequences of different length

k(#) restrict indels (to save calculation time)

additional options
ignorecase ignore case of letter

asciilettersonly sets all non-ascii-letters to missing

soundex caluculate distance on soundex transformed strings

merge options

Description

sqstrmerge merges the master and the using data by
finding the closest match of the key variable in the using data. The
closest match is defined as the match that have the smalles Levenshtein
distance. The command merges close mathches only up to the Levenshtein
distance specified in the option max()

Options

max(#) do not macht observations with a Levenshtein distance larger than the number specified. This option is requried. The default is indelcost(1).

indelcost(#) specifies the cost attached to an
insertion or deletion of an alignment. The default is indelcost(1).

subcost(#|implied
formula|matexp|matname} specifies the cost attached to a
substitution in an alignment. Substitution costs may be specified as
real number, or as full matrix. Specifying
substitution cost as, for example, subcost(3) will attach the
cost of 3 to any substitution necessary in an alignment, regardless of
how similar the substituted values may be. The default is two times
the value specified as indel cost. A full substitution cost matrix
can be specified either by specifying the name of a matrix containing
the substitution cost or by typing valid matrix syntax into the option
itself. The matrix has to be a symmetric n*n matrix, where n is the
number of different elements in all sequences.

standard(#|cut|longer|longest|none)
is used to define the standardization of the resulting distances. With
standard(#) all sequences are cut to the length #. The keyword
cut automatically cuts all sequences to the length of the
shortest sequence in the dataset. standard(longer) divides all
distances by the length of the longer sequence of the respective
alignment. standard(longest) divides all distances by the length
of the longest sequence in the dataset; this is the
default. none is specified if no standardization is needed.

k(#) is used to speed up the calculation of the
optimal matching algorithm. Within the parentheses, an integer
positive number between 1 and the number of positions of the longest
sequence can be given. The speed up will be higher with small numbers.
Very small numbers can have the effect that the algorithm doesn't find
the best alignment between some sequences, and this problem tends to
increase if substitution costs are high relative to indel
costs. The option is ignored when option sadi() is specified.

Note: The implementation of the k() is based partly on the
source code of TDA, written by Goetz Rohwer and Ulrich Poetter. TDA is
a very powerful program for transitory data analysis. It is programmed
in C and distributed as freeware under the terms of the General
Public License. It is downloadable from
http://www.stat.ruhr-uni-bochum.de/tda.html.

ignorecase ignore case of letter so that a=A, b=B ... z=Z, and vice versa.

asciilettersonly} All non-ascii-letters are removed from the string if this option is specified.

soundex calculate distance on soundex transformed
strings. See soundex() for an explanation of the
soundex-transformation

Example(s)

. sqstrmerge 1:1 prename, max(2)

Author

Ulrich Kohler
email: ukohler@uni-potsdam.de