Chapter Contents



Tools for Managing Libraries

SAS Utilities

The SAS utilities available for SAS file management are designed to enable you to work with more than one SAS file at a time, as long as the files belong to the same library. The advantage of learning and using SAS Explorer, functions, options and procedures is that they automatically copy, rename, or delete any index files or integrity constraints, audit trails, backups and generation data sets that are associated with your SAS data files. Another advantage is that SAS utility procedures work on any operating environment at any level.

There are several SAS window options, functions and procedures available for performing file management tasks. You can use the following features alone or in combination, depending on what works best for you. See "Choosing the Right Procedure" in the SAS Procedures Guide for detailed information on SAS utility procedures. The SAS windowing environment and how to use it for managing SAS files is discussed in online Help.

CATALOG procedure
provides catalog management utilities with the COPY, CONTENTS, and APPEND procedures.

DATASETS procedure
provides all library management functions for all member types except catalogs. If your site does not use the SAS Explorer, or if SAS executes in batch or interactive line mode, using this procedure can save you time and resources.

SAS Explorer
includes windows that enable you to perform most file management tasks without submitting SAS program statements. Type LIBNAME, CATALOG or DIR in the Toolbar window to use SAS Explorer, or select the Explorer icon from the Toolbar menu.

DETAILS system option
Sets the default display for file information when using the CONTENTS, or DATASETS procedure. When enabled, DETAILS provides additional information about files, depending on which procedure or window you use.

Library Directories

SAS Explorer and procedures enable you to obtain a list, or directory, of the members in a SAS data library. Each directory contains the name of each member and its member type. For the member type DATA, the directory indicates whether an index, audit trail, backup, or generation data set is associated with the data set. The directory also describes some attributes of the library, but the amount and nature of this information vary greatly with the operating environment.

Note:   SAS data libraries can also contain various SAS utility files. These files are not listed in the library directory and are for internal processing.  [cautionend]

Accessing Permanent SAS Files without a Libref

SAS provides you with another method of accessing files in addition to creating a libref with the LIBNAME statement or using the New Library window. To use this method, enclose the filename, or the filename and path, in single quotatation marks.

For example, in a directory based system, if you want to create a data set named "mydata" in your default directory, that is, in the directory that you are running SAS in, you can write the following line of code:

data 'mydata';
SAS creates the data set and remembers its location for the duration of the SAS session.

If you omit the single quotation marks, SAS creates the data set "mydata" in the temporary WORK subdirectory, named WORK.mydata:

data mydata;
If you want to create a data set named "mydata" in a library other than the directory in which you are running SAS, enclose the entire path in quotation marks, following the naming conventions of your operating environment. For example, the following DATA step creates a data set named FOO in the directory C:\sasrun\mydata.
data 'c:\sasrun\mydata\foo';
This method of accessing files works on all operating environments and in most contexts where a libref.memname is accepted as a SAS dataset. Most dataset options can be specified with a quoted name.

You cannot use quoted names for:

Operating Environment Examples
DOS, Windows
data 'c:\root\mystuff\sasstuff\work\myfile' ;
data '/u/root/mystuff/sastuff/work/myfile';
UNIX System Services under OS/390
data '/mystuff/sastuff/work/myfile';
data '< filetype> filemode |* ';
data '/mystuff/sastuff/work/myfile';
data 'filename filetype filemode';

Operating Environment Commands

You can use operating environment commands to copy, rename, and delete the operating environment file or files that make up a SAS data library. However, to maintain the integrity of your files, you must know how the SAS data library model is implemented in your operating environment. For example, in some operating environments, SAS data sets and their associated indexes can be copied, deleted, or renamed as separate files. If you rename the file containing the SAS data set, but not its index, the data set will be marked as damaged.

Using operating environment commands can damage files. You can avoid problems by always using SAS utilities to manage SAS files.  [cautionend]

Sequential Data Libraries

SAS provides a number of features and procedures for reading from and writing to files that are stored on sequential format devices, either disk or tape. Before you store SAS data libraries in sequential format, you should consider the following

Operating Environment Information:   The details for storing and accessing Version 6 and Version 5 SAS files in sequential format vary with the operating environment. See the SAS documentation for your operating environment for further information.  [cautionend]

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.