help mata mm_invtokens()
-------------------------------------------------------------------------------

Title

mm_invtokens() -- Convert a string vector into a string scalar

------------------------------------------------------------------------------- Note: An official invtokens() function was introduced in Stata 10 (see help [M-5] invtokens()). -------------------------------------------------------------------------------

Syntax

string scalar mm_invtokens(string vector s [, real scalar noclean])

Description

mm_invtokens() is the "inverse" of tokens(). It returns the elements of s joined together in a single string where the individual elements are separated by blanks.

Elements containing blanks are enclosed in double quotes ("..."). Elements containing double quotes are enclosed in compound double quotes (`"..."'). Empty elements are returned as "".

noclean!=0 causes all elements to be enclosed in compound double quotes.

Remarks

Example:

: s1 = ("mpg", "weight", "displacement") : s1 1 2 3 +----------------------------------------------+ 1 | mpg weight displacement | +----------------------------------------------+

: s2 = mm_invtokens(s1) : s2 mpg weight displacement

Conformability

mm_invtokens(s, noclean) s: r x 1 or 1 x c noclean: 1 x 1. result: 1 x 1.

Diagnostics

None.

Source code

mm_invtokens.mata

Author

Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also see