In SAS, how do I access a permanent data set stored on a disk?

Use the LIBNAME statement to access SAS permanent data sets. Depending on releases, the extension of a SAS data set can be .ssd (version 6.04 for DOS/Windows), .ssd01 (version 6 for Unix), .sd2 (version 6.08 to 6.12), .ssd04 (DEC machines), .sd7 (version 7 or 8), or .sas7bdat (version 8 and later).

Suppose you want to read a SAS data set named grade.sas7bdat in the ~/data directory. The following example shows how to retrieve a SAS data set:

  LIBNAME stat '~/data';

  DATA stat.new_grade;
     SET stat.grade;
     ...
  RUN;

LIBNAME associates a SAS library reference (libref) with a directory. In this example, stat is the libref that aliases ~/data. In Windows, an alias consists of drive and directory names (e.g., c:\data\). The SET statement reads existing SAS data sets specified. This example tells SAS to read a SAS data set grade.sas7bdat from the library stat, perform some data manipulation, and then write the result into new_grade.sas7bdat in ~/data, which is associated with the library stat.

If you have questions about using statistical and mathematical software at Indiana University, contact Research Analytics. Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200; staff are available for consultation Monday-Friday 9am-noon and by appointment.

This is document afdu in the Knowledge Base.
Last modified on 2015-06-19 00:00:00.

Contact us

For help or to comment, email the UITS Support Center.