Previous Page | Next Page

Reading and Writing Data

Use 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 on which SAS/IML Studio runs. 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:

  • C:\Program Files\SAS\SASIMLStudio\3.2\Data Sets\Hurricanes.sas7bdat

  • \\PC123\Public\Data\climate.sas7bdat

  • U:\SAS Data\patients.sas7bdat

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 define by using the LIBNAME statement. For example, the following are server data sets:

  • Sashelp.Class

  • Work.Data1

  • MyLib.Research

Open a Client Data Set

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

Select File Open File from the main menu. The dialog box in Figure 2.1 appears.

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

  • Double-click the Data Sets folder.

  • Select the Hurricanes.sas7bdat file.

  • Click Open.

  • Figure 2.1 Opening a Client Data Set
    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 XP

    C:\Documents and Settings\userid\My Documents\My IML Studio Files

    Windows Vista

    C:\Users\userid\Documents\My IML Studio Files

    Open a Server Data Set

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

    Select File Open Server Data Set from the main menu. The dialog box in Figure 2.2 appears.

  • Click the node labeled with your server name to open it. If the SAS System is running on your PC, the server name is My SAS Server.

  • Click the SASHELP folder to view the data sets in the Sashelp library.

  • Select the CLASS data set.

  • Click OK.

  • Figure 2.2 Opening a Server Data Set
    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, the SAS System 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