Chapter Contents


SAS Companion for the CMS Environment

Accessing SAS Libraries in Segments

For improved performance you can create and read SAS data libraries that are stored in CMS segments. To implement SAS libraries in segments, install SAS accordingly, as specified in the installation instructions for the SAS System under CMS.

Access to a SAS library in a segment (READ-only) requires a slight modification of the usual LIBNAME statement, using the following syntax:

LIBNAME libref <engine<'segment-name'> SEGMENT=YES>;

is a name that identifies the library. If 'segment-name' is not specified, then SAS uses the libref as the segment name, which means that it cannot contain characters such as an underscore (-), which is valid in a filetype but invalid in a segment name.

identifies the engine to be loaded to process the library. Only a base engine may be specified. Valid base engine names are V8, V7, or V6.

is a quoted string that provides the name of the segment if it is different from the libref. The string must consist of a single alphanumeric name of up to 8 characters from the set: a through z, A through Z, 0 through 9, @, #, $. Specify a segment name when you want to use the libref as an alias for the segment name.

SAS issues a SEGMENT RESERVE command for the segment and then loads the segment with a DIAGNOSE instruction. If either command fails for any reason, the LIBNAME statement fails.

A libref that is assigned to a library in a segment receives a path name of segment-name SG. The filetype is segment-name and the file mode is SG.


A segment named LABDATA contains a SAS library. The following example loads the library and assigns the libref LABDATA:

libname labdata segment=yes;

This next example loads a SAS library in the segment named SALEDATA and assigns the libref BOOKDATA:

libname bookdatab 'saledata' segment=yes;

Chapter Contents



Top of Page

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