SAS Data Library

SAS Data Library (How to use/open a SAS data set)


  • A SAS data library is a collection of one or more SAS data files.
  • On the Windows, Unix or Linux platforms, the SAS data library is simply a directory.

How to use/open a SAS data set

  • Use the LIBNAME statement:

        libname in1 "d:\projectX\data\";  ** Windows example **; 
        libname in1 "/projectX/data/";  ** Linux/Unix example **;
        data one; 
          set in1.demo;

  • Or use direct reference:

        data one;
         set "D:\sasclass\demo.sas7bdat";  ** Windows example **; 
         set "/sasclass/demo.sas7bdat";    ** Linux/Unix example **; 

  • Use the SAS Explorer Window
    • Or go to the Explorer Window and highlight Libraries.
    • Go to the menu at the top and choose File-New.  A New Library window should appear.
    • In the New Library window:
      • Enter the library reference in the Name box.
      • Choose an engine from the Engine pull-down menu.
      • Enter the Path or directory name for the library.
      • Click the Enable at startup button, if you want this library to be assigned every time you start a SAS session.
    • Click OK and you now have access to the new library via your library reference.

What are SAS engines?

SAS engines determine what version of SAS the data file is.  The glory days were during SAS 8 when the default engine type was the V8!  If no engine is specified, then SAS chooses the current version of SAS.  List of SAS engines:
  • V9 is version 9
  • V8 is version 8
  • V7 is version 7
  • The above all have file extensions of .sas7bdat
  • V6 is version 6. On Unix it has the file extension .ssd01, on Linux it has the file extension .ssd02,  and on Windows it has .sd2.  SAS 9 will read a SAS 6 data file but not save to one.
  • Transport/xport files may use the xport engine and have any file extension you want.  File extension .xpt is a pretty popular one.


Example SAS code specifying an engine:

    libname in1 v8 "C:\projectX\data\";
    data one; 
      set in1.demo; 


Another topic?

Wink Plone Theme by Quintagroup © 2013.

Personal tools
This is themeComment for Wink theme