|
Chapter Contents |
Previous |
Next |
| Language Reference |
For example, the statement
r=shape(12,3,4);produces the result shown:
R 3 rows 4 cols (numeric)
12 12 12 12
12 12 12 12
12 12 12 12
The next statement
r=shape(77,1,5);produces the result matrix by moving along the rows until the desired number of elements is obtained, cycling back as necessary:
R 1 row 5 cols (numeric)
77 77 77 77 77
The statement below
r=shape({1 2, 3 4, 5 6},2);
has nrow specified and converts the
3 ×2 matrix into a 2 ×3 matrix.
R 2 rows 3 cols (numeric)
1 2 3
4 5 6
The statement
r=shape({99 31},3,3);
demonstrates the cycling back and repetition of elements in
row-major order until the number of elements desired is obtained.
R 3 rows 3 cols (numeric)
99 31 99
31 99 31
99 31 99
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.