![]() Chapter Contents |
![]() Previous |
![]() Next |
Language Reference |
concatenates matrices vertically
The vertical concatenation operator (//) produces a new matrix by vertically joining matrix1 and matrix2. Matrix1 and matrix2 must have the same number of columns, which is also the number of columns in the new matrix. For example, if A has three rows and two columns and B has four rows and two columns, then A//B produces a matrix with seven rows and two columns. Rows 1 through 3 of the new matrix correspond to A; rows 4 through 7 correspond to B.
For example, the statements
a={1 1 1, 7 7 7}; b={0 0 0, 8 8 8}; c=a//b;result in
C 4 rows 3 cols (numeric) 1 1 1 7 7 7 0 0 0 8 8 8Also let
b={"AB" "CD", "EF" "GH"};and
c={"I" "J", "K" "L", "M" "N"};Then the statement
a=b//c;produces the new matrix
A 5 rows 2 cols (character, size 2) AB CD EF GH I J K L M N
For character matrices, the element size of the result matrix is the larger of the element sizes of the two operands.
You can use the vertical concatenation operator when one of the arguments has not been assigned a 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.