Chapter Contents |
Previous |
Next |
Language Reference |
concatenates matrices horizontally
The horizontal concatenation operator (||) produces a new matrix by horizontally joining matrix1 and matrix2. Matrix1 and matrix2 must have the same number of rows, which is also the number of rows in the new matrix. The number of columns in the new matrix is the number of columns in matrix1 plus the number of columns in matrix2.
For example, the statements
a={1 1 1, 7 7 7}; b={0 0 0, 8 8 8}; c=a||b;result in
C 2 rows 6 cols (numeric) 1 1 1 0 0 0 7 7 7 8 8 8Also, if
b={A B C, D E F};and
c={"GH" "IJ", "KL" "MN"};then
a=b||c;results in
A 2 rows 5 cols (character, size 2) A B C GH IJ D E F KL MN
For character operands, the element size in the result matrix is the larger of the two operands. In the preceding example, A has element size 2.
You can use the horizontal concatenation operator when one of the arguments has no value. For example, if A has not been defined and B is a matrix, A ||B results in a new matrix equal to B.
Quotation marks (") are needed around matrix elements only if you want to embed blanks or maintain uppercase and lowercase distinctions.
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.