Stata 15 help for mf_abbrev
[M5] abbrev()  Abbreviate strings
Syntax
string matrix abbrev(string matrix s, real matrix n)
Description
abbrev(s, n) returns s abbreviated to n display columns. Usually, this
means it will be abbreviated to n characters, but if s contains
characters requiring more than one display column, such as Chinese,
Japanese, and Korean (CJK), s will be abbreviated such that it does not
exceed n display columns.
1. n is the abbreviation length and is assumed to contain integer
values in the range 5, 6, ..., 32.
2. If s contains a period, ., and n < 8, then the value n defaults
to 8. Otherwise, if n < 5, then n defaults to 5.
3. If n is missing, the entire string (up to the first binary 0) is
returned.
If there is a binary 0 in s, the abbreviation is derived from the
beginning of the string up to but not including the binary 0.
When arguments are not scalar, abbrev() returns elementbyelement
results.
Conformability
abbrev(s, n):
s: r1 x c1
n: r2 x c2; s and n rconformable
result: max(r1,r2) x max(c1,c2)
Diagnostics
abbrev() returns "" if s is "". abbrev() aborts with error if s is not a
string.
Source code
Function is built in.
