Reading and Writing Data

Create a DataObject from SAS/IML Matrices

If you have data in SAS/IML matrices, you can create a DataObject from those matrices by using the Create method of the DataObject. For example, type the following statements into a SAS/IML Studio program window, and select ProgramRun from the main menu.

   xy = {0 4,  
         1 6,  
         2 7,  
         3 9,  
         4 10}; 
   declare DataObject dobjMatrix; 
   dobjMatrix = DataObject.Create("Matrix", {"XVar" "YVar"}, xy); 

The $5 \times 2$ matrix xy is used to initialize the dobjMatrix DataObject. The result is a DataObject with two variables (named XVar and YVar) and five observations.