A.20. Creating a SAS Data Set from a Matrix
Conversely, we can create a SAS data set out of a matrix. An example is presented here. Suppose we have a 5 by 3 matrix titled MYMATRIX containing five observations on three variables for which we will use the default names COL1, COL2 and COL3. From this, we wish to create a data set named NEWDATA. It is done as follows.
proc iml; mymatrix = { 2 4 8, 3 9 1, 9 4 8, 1 1 1, 2 7 8; create newdata from mymatrix; append from mymatrix; close newdata; proc print data = newdata;
Get APPLIED MULTIVARIATE STATISTICS: WITH SAS® SOFTWARE now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.