Understanding the SAS/IML Language

Numeric Literals

To specify a matrix literal with multiple elements, enclose the elements in braces. Use commas to separate the rows of a matrix. For example, the following statements assign and print matrices of various dimensions:

x = {1 . 3 4 5 6};                   /* 1 x 6 row vector */
y = {1,2,3,4};                       /* 4 x 1 column vector */
z = 3#y;                             /* 3 times the vector y */
w = {1 2, 3 4, 5 6};                 /* 3 x 2 matrix */
print x, y z w;

Figure 1: Matrices Created from Numeric Literals

x
1.3456

yzw 
1312
2634
3956
412  


Last updated: July 20, 2026