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;

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.182.45