Concatenates and truncates lines (units) of text structures; allows the case of letters to be changed.
||Text to hold the concatenated/truncated lines; default is the first
||Case to use for letters (
||Texts to be concatenated|
||Number of characters to take from the lines of each text, a negative value takes all the (unskipped) characters other than trailing spaces; if
||Number of characters to skip at the left-hand side of the lines of each text, a negative value skips all initial spaces; if
CONCATENATE directive joins lines of several texts together, side by side, to form a new text. You can specify the identifier of this text by the
NEWTEXT option, in which case it need not already have been declared as a text. If you do not specify
NEWTEXT, Genstat places the new textual values into the first text in the
OLDTEXT parameter list (replacing its existing values).
The texts to be concatenated are specified by
OLDTEXT; they should all contain the same number of lines, unless you want to insert an identical series of characters into every line of the new text: a series of characters that is to be duplicated within every line can be specified either as a string, or in a single-valued text.
If you give a variate in the
SKIP list, then it must contain a value for each line of the text in the
OLDTEXT list; the value indicates the number of characters to be omitted at the beginning of that line. Alternatively, you can give a scalar if the same number of characters is to be omitted at the start of every line. Similarly the
WIDTH parameter specifies how many characters are to be taken, after omitting any initial characters as specified by
CONCATENATE also provides easy ways of removing spaces at the beginning or the end of strings. A negative value of the
SKIP parameter deletes all the spaces at the start of a string, while a negative value of the
WIDTH parameter deletes all the spaces at the end of a string.
CASE option enables you to change the case of letters. By default,
CASE=given to leave the case of each letter as given in the existing text. To change all letters to upper case (or capitals) you can put
CASE=lower to change all letters to lower case. Alternatively,
CASE=changed puts lower-case letters into upper case, and upper-case letters into lower case!
CONCATENATE takes account of restrictions on any of the vectors that occur in the statement. If more than one vector is restricted, then each such restriction must be the same. The values of the units that are excluded by the restriction are left unchanged.
Commands for: Calculations and manipulation.
" Example CONC-1: Use of the CONCATENATE directive" TEXT [VALUES=' 1. Adams',' 2. Baker',' 3. Clarke',' 4. Day',' 5. Edwards',\ ' 6. Field',' 7. Good',' 8. Hall',' 9. Irving','10. Jones'] Name TEXT [VALUES='B.J.','J.S.','K.R.','A.T.','R.S.',\ 'T.W.','S.I.','D.M.','H.M.','C.C.'] Initials " form Fullname with number, name & initials " CONCATENATE [NEWTEXT=Fullname] OLDTEXT=Name,' ',Initials PRINT Fullname ; JUSTIFICATION=left " form Fullname with initials & name " CONCATENATE [NEWTEXT=Fullname] OLDTEXT=Initials,Name ; SKIP=*,3 PRINT Fullname ; JUSTIFICATION=left