Sometimes it is convenient to read all the numeric variables into columns of a matrix. To do this, use the READ statement with the INTO clause and specify the name of a matrix to create. Each variable that is specified in the VAR clause becomes a column of the target matrix. If there are variables in the VAR clause and observations are processed, the target matrix is an matrix.
The following statement creates a matrix X
that contains the first five observations of the numeric variables of the Sashelp.Class
data set. The keyword _NUM_ in the VAR clause specifies that all numeric variables be read.
proc iml; use Sashelp.Class; read point (1:5) var _NUM_ into X; print X;
Every SAS/IML matrix is of either character or numeric type. Therefore, when you read data by using the INTO clause, you should use the _NUM_ or _CHAR_ keyword to specify the types of variables that you want to read. If you use the _ALL_ keyword with the INTO statement, all numeric variables are read.