.-
help for ^catenate^
.-

Concatenation into string variable -----------------------------------

^catenate^ newvar = varlist [^if^ exp] [^in^ range] [^, p^unct^(^punctchars^)^ ]

Description ------------

^catenate^ generates a new string variable by concatenating varlist. The variables in varlist may be string or numeric.

Remarks --------

^catenate^ merely automates the use of ^generate^, as in

^gen^ str# newvar ^=^ strvar1 ^+^ strvar2

or

^gen^ str# newvar ^=^ strvar1 ^+ " " + ^ strvar2

Indeed, ^generate^ is preferable for problems as simple as these.

^catenate^ has these advantages: it is easier to specify a longer varlist and separating punctuation; characters will not be lost by truncation merely because the str# specified was too small; and there is automatic conversion of numeric values (although possible unwanted side-effects with non-integers).

Option -------

^punct(^punctchars^)^ specifies punctuation characters to separate the values of the original variables. The default is a single space ^" "^. As a special case ^punct(no)^ means no punctuation, that is, values are not separated.

Examples ---------

. ^l

^size beast num^ ^1. small frog 1^ ^2. small toad 2^ ^3. big camel 3^ ^4. so-so gnu 4^ ^5. tiny ant 5^

. ^catenate zoo = num size beast^ . ^catenate Zoo = num size beast, p(,)^

. ^l zoo Zoo^

^zoo Zoo^ ^1. 1 small frog 1,small,frog^ ^2. 2 small toad 2,small,toad^ ^3. 3 big camel 3,big,camel^ ^4. 4 so-so gnu 4,so-so,gnu^ ^5. 5 tiny ant 5,tiny,ant^

Author -------

Nicholas J. Cox, University of Durham n.j.cox@@durham.ac.uk