• Articles
  • Tutorials
  • Interview Questions

SAS File Concept

Tutorial Playlist

This section of the SAS tutorial will teach you about the SAS libraries, types of libraries, referencing SAS files, various types of SAS files and more.

SAS Libraries

SAS files are stored in Libraries so SAS Library is a collection of SAS Files. SAS files are called SAS datasets. SAS Libraries have different implementation depending on our operating system. For example in Windows and UNIX environment, a library is typically a group of SAS files in same folder or directory.
Two types of libraries:

  • Temporary Library
  • Permanent Library

Temporary Library:

  • Its Temporary Storage Location of a data file
  • This lasts only for the current SAS Session
  • Work is the temporary library in SAS
  • When the session ends, the data files in the temporary library are deleted.
  • The file is stored in Work, when 1) No specific library name is used while creating file 2) Specifying library name as “Work”

Permanent Library:

  • As the name suggest, it is used for storing data files permanently.
  • Permanent SAS data libraries are stored until we delete them.
  • To store the files permanently in a SAS data library, specify library name other than Work.
  • Three default permanent Libraries provided by SAS are: Local , SASUser and SAShelp
  • SASHELP contains group of catalogs and other information to control SAS session
  • SASUSER contains personal settings

Looking for Top Jobs in Data Science ? This blog post gives you all the information you need !

Referencing SAS Files:

To reference a SAS file two-level name is used:
Libref.filename
Libref – Name of the SAS data library
Filename – Name of the SAS file
.(Period) – Separate libref and filenames
This blog will help you get a better understanding of  SAS !

Referencing Temporary SAS files:

Ex: Will consider filename as “SASFile1”.
Option1: Two-level name: Work.SASFile1
Work – It is the temporary SAS library
Option2: One-level name: SASFile1 (default it is stored in SAS library Work)

Referencing Permanent SAS files:

Before referencing permanent SAS files, we need to define them using LIBNAME Statement.

Certification in Bigdata Analytics

LIBNAME Statement:

LIBNAME libref ‘SAS-data-library’;

Libref: 1-8 characters long. Begin with letter or underscore. It contains only letters, numbers and underscores.
SAS-data-library: Physical location of the file. Specification of the file varies by operating system. Contents of    permanent library exist in the path specified.
Ex: libname policyDet ‘c:\INS\policy’;
Libname is global, which means libref remain in effect until we modify, cancel or end your SAS session.
LIBNAME assign the libref for current SAS session only, so each time we begin a SAS session, we must assign libref to each  permanent data library.

We have only one option to reference permanent SAS files:
Ex: Two-level-name:  policyDet.Autoinfo (Any library without Work)

Check out the SAS Interview Questions to learn what is expected from SAS professionals!

More option on LIBNAME Statement:
LIBNAME libref CLEAR; — Disassociating one libref Ex: LIBNAME policyDet CLEAR
LIBNAME ALL CLEAR;  — Disassociating all assigned libref
LIBANAME libref (‘file1’ ‘file2’ ‘file3’); — Concatenating SAS Libraries by specifying the physical filename of each.

SAS files can be any of the following file types in addition to SAS datasets

  • SAS Catalog
  • Compiled SAS Program
  • SAS Utility file
  • Database files
  • Item store files.

Course Schedule

Name Date Details
Big Data Course 20 Apr 2024(Sat-Sun) Weekend Batch
View Details
Big Data Course 27 Apr 2024(Sat-Sun) Weekend Batch
View Details
Big Data Course 04 May 2024(Sat-Sun) Weekend Batch
View Details

Big-Data-ad.jpg