Reading and Writing Data

Using the GUI to Read a SAS Data Set

A SAS data set can be opened as a client data set if it is accessible by the PC operating system of the computer running Stat Studio. A data set on a USB flash drive, hard drive, CD drive, or DVD drive can be opened as a client data set. So, too, can a data set on a networked PC or a UNIX data set that is accessible through a mounted networked drive. For example, the following can be opened as client data sets:

A SAS data set is a server data set if it is in a SAS library such as WORK, SASUSER, or SASHELP, or in a libref that you defined by using the LIBNAME statement. For example, the following are server data sets:

Opening Client Data Sets

To use the GUI to open a SAS data set on the client:

  1. Select File \blacktriangleright\,Open \blacktriangleright\,File from the main menu. The dialog box in Figure 2.1 appears.
  2. Click Go to Installation directory near the bottom of the dialog box.
  3. Double-click on the Data Sets folder.
  4. Select the Hurricanes.sas7bdat file.
  5. Click Open.


statdatafileopen.png (38036 bytes)

Figure 2.1: Opening a Client Data Set

A data table appears, showing a tabular view of the data. Connected to the data table (although invisible) is an underlying DataObject that was created from the SAS data set. The DataObject holds the data in memory; the data table displays a view of the data.

Note: Clicking Go to Personal Files directory navigates to your personal files directory. By default, the personal files directory corresponds to the Windows directory shown in Table 2.1.

Table 2.1: The Personal Files Directory
Windows XPC:\Documents and Settings\userid\My Documents\
 My Stat Studio Files
Windows VistaC:\Users\userid\Documents\My Stat Studio Files

Opening Server Data Sets

To use the GUI to open a SAS data set in a library on the server:

  1. Select File \blacktriangleright\,Open \blacktriangleright\,Server Data Set from the main menu. The dialog box in Figure 2.2 appears.
  2. Click on the node labeled with your server name to open it. If SAS is running on your PC, the server name is My SAS Server.
  3. Click on the SASHELP folder to view the data sets in the SASHELP library.
  4. Select the CLASS data set.
  5. Click OK.


statdataserveropen.png (7679 bytes)

Figure 2.2: Opening a Server Data Set

A data table appears, showing a tabular view of the data. There is a DataObject (not visible, but still present) connected to the data table.

Note: Figure 2.2 shows librefs that are not predefined. If your PC is your SAS server, you can create an AutoExec.sas file in the C:\ root directory that contains LIBNAME statements that define librefs on your PC. Everytime a SAS server starts, SAS executes the AutoExec.sas file automatically. If you are running a SAS server on another computer, ask your site administrator to set up librefs for you.

Previous Page | Next Page | Top of Page