Reading and Writing Data


Use a Program to Read a SAS Data Set

As explained in Chapter 1: Introduction to SAS/IML Studio, the DataObject class stores an in-memory version of data. You can query, retrieve, and manipulate the data by calling methods in the DataObject class. All graphical and tabular views of those data are linked together through the common DataObject. Therefore, when you want to create a graph of some data, or to look at the data in a table, you first need to create a DataObject.

A DataObject is typically created from a SAS data set. As explained in the introduction to this chapter, a client data set is accessible through the Windows operating environment, whereas a server data set resides in a SAS library.

In this section you write a program to create a DataObject from a SAS data set and save data from a DataObject to a SAS data set. You can open a program window by selecting FileNewWorkspace from the main menu.

The program statements in this chapter are distributed with SAS/IML Studio. To open the program that contains the statements:

  1. Select FileOpenFile from the main menu.

  2. Click Go to Installation directory near the bottom of the dialog box.

  3. Navigate to the Programs\Doc\STATGuide folder.

  4. Select the Data.sx file.

  5. Click Open.