Chapter Contents

Previous

Next
LIBNAME

LIBNAME



Associates a libref with a SAS data library or lists file attributes for a SAS data library

Valid: anywhere
CMS specifics: libref, engine, physical-name, engine/host-options


Syntax
Details
See Also

Syntax

LIBNAME libref <engine> 'physical-name' <options>;
LIBNAME libref engine <'segment-name'> SEGMENT=YES <options>;
LIBNAME libref | _ALL_ CLEAR;
LIBNAME libref | _ALL_ LIST;

libref
is a first-level SAS name that identifies the library. The libref can be a maximum of eight characters. The first character must be a letter (A through Z) or an underscore (_). The remaining characters can be any of these characters or numerals (0 through 9). This libref is used to reference the library throughout SAS.

engine
is a SAS name that identifies the engine to be loaded to process the library. The default engine that is used for new libraries is the BASE engine. Valid values for engine include the following:

V8 (BASE)
specifies the engine for accessing SAS files in the latest format available. BASE is an alias for V8.

V8TAPE (TAPE) (V8SEQ)
specifies the engine for accessing SAS files in the latest sequential format, either on tape or disk. TAPE is an alias for V8TAPE.

V7
specifies the engine for accessing SAS files Version 7 format.

V7TAPE
specifies the engine for accessing SAS files in Version 7 sequential format, either on tape or disk.

V6
specifies the engine for accessing SAS data sets that were created under the Version 6 releases of SAS.

V6TAPE
specifies the engine for accessing SAS files in the Version 6 sequential format, either on tape or disk.

V5 (V5TAPE)
specifies the engine for accessing SAS data sets that were created under the Version 5 releases of SAS.

BMDP
specifies the engine for accessing BMDP files.

ORACLE
specifies the engine for accessing ORACLE data sets.

OSIRIS
specifies the engine for accessing OSIRIS files.

SPSS (SPSSX)
specifies the engine for accessing SPSS files.

SQLDS
specifies the engine for accessing SQL data sets.

SQLVIEW
specifies the engine for accessing SQL data views.

XPORT
specifies the engine for accessing files in transport format.

See SAS Library Engines for more details on engines.

'physical-name'
is a quoted string that describes the physical location of the library. The physical-name can be specified in the following ways:

'filemode'
specifies the disk-mode letter or the disk-mode letter and optional filemode access number. Use this form for physical-name when you want to use a filemode other than the default. If you specify filemode as `' or `*', SAS uses the standard CMS search order to locate an existing SAS library. If the library exists on more than one minidisk, then SAS stops searching as soon as it finds a member. Consequently, only the member on that minidisk is used. Otherwise, if the library does not exist, the assignment defaults to the first R/W accessed disk.

'filetype filemode'
specifies the filetype to be used for the library and the disk-mode letter. filemode can also include a filemode access number. Use this form for physical-name when you want to use the libref as an alias for the filetype.

'filetype sfs-dir'
specifies an SFS directory to be used as a SAS library. Use this form for physical-name when you want to use the libref as an alias for the filetype.

'sfs-dir'
specifies an SFS directory to be used as a SAS library.

'filename filetype filemode'
specifies the complete CMS fileid. Use this form for physical-name with the BMDP, OSIRIS, SPSS, and XPORT engines.

('filetype-1 <filemode-1 | SFS-directory-1>' . . .'filetype-n <filemode-n | SFS-directory-n'>)
specifies a concatenation of more than one library that will be accessed by SAS in order of specification using a single fileref. See Concatenating SAS Data Libraries for more information on concatenation of SAS data libraries.

'TAPn'
specifies the tape device for a sequential library. n is a hex character from 0 through F.

'segment-name' SEGMENT=YES
If the option SEGMENT=YES is specified, segment-name specifies the name of a segment that contains the library. If segment-name is not specified and SEGMENT=YES is specified, then SAS uses the libref as the segment name.

engine/host-options
is a list of host and engine options to be applied to this library. When specifying more than one option, use a blank space to separate each option. engine/host-options can be specified in the following format:

option-1=value option-2=value

The following list presents valid options for engine/host-options. Of these options, only the BLKSIZE= option is meaningful with disk libraries. All of the others are for sequential format libraries only.

BLKSIZE=nnnnn
specifies the logical block size in bytes of the file. nnnnn must be greater than 0 but less than or equal to 32,760. The default is 32,760.

DENSITY=
specifies the tape density. Valid values are

  • 200

  • 556

  • 800

  • 1600

  • 6250

  • 38K.

If the DENSITY= option is not specified, the tape density will be the density that the tape drive was last assigned.

DISP=MOD
for a sequential library, DISP=MOD specifies that members copied into the library with the COPY procedure will be appended to the end of the library without checking for duplicate members. By default, when DISP=MOD is not specified, the COPY procedure replaces all existing members in the destination sequential library with the new members copied into the destination library from the source library.

The DISP=MOD option is valid only for sequential libraries using the V6TAPE or later engine. This option applies only to the COPY procedure.

Any duplicate members appended to the end of the sequential library will not be accessed by SAS, since SAS accesses the first member with the specified name. To ensure that all members in the destination library can be accessed by SAS, you can:

  • Use the EXCLUDE statement in the COPY procedure.

  • Remove unwanted duplicate members after the COPY procedure using the DELETE statement in the DATASETS procedure.

  • Rename duplicate data sets using the RENAME statement in the DATASETS procedure.

For details on the DELETE and RENAME statements of the DATASETS procedure, see SAS Procedures Guide . For further information on sequential tape processing, see Working with SAS Files on Tape.

DSN=
specifies the OS/390 data set name (one- to eight-byte qualifiers separated by periods, up to 44 characters long, including periods) of a SAS data set residing on OS/390-shared DASD. Enclose the value in single quotes.

EOV=
specifies whether there is automatic limited end-of-volume processing when the end of the tape is sensed on output. Valid values are
YES specifies that there is end-of-volume processing. This is the default.
NO specifies that there is not end-of-volume processing.

LABEL=
specifies the type of tape label. Valid values are
SL <n> specifies the IBM standard label. n is the position of the file on a multifile volume. If n is not specified, 1 is assumed.
NL <n> specifies that the tape has no IBM standard labels. n is the position of the file on a multifile volume. If n is not specified, 1 is assumed.
BLP <n> specifies that label processing is to be bypassed, but that the tape is to be positioned before the library is processed. n is the position of the file on a multifile volume. If n is not specified, 1 is assumed.
LABOFF specifies that there is to be no label processing. The tape is not positioned if this value is specified. This is the default.

LEAVE=
specifies whether a standard label tape is to be moved before processing the label. This option is valid only when LABEL=SL is specified. Valid values are
YES specifies that the tape is not to be moved before processing the label.
NO specifies that the tape is to be rewound before processing the label. This is the default.

SEGMENT=
specifies that the library is (SEGMENT=YES) or is not (SEGMENT=NO) contained in a CMS saved segment.

SYSPARM=
passes an option string to a tape management system for standard label tapes. See Working with SAS Files on Tapefor further information.

TRACK=
specifies the tape setting. Valid values are

  • 7TRACK

  • 9TRACK

  • 18TRACK.

  • 3490B

  • 3490C

  • 3590B

  • 3590C

  • XF

VOLID=vvvvvv
specifies the one- to six-character serial number that identifies the volume. If the vol id is not a valid SAS name, you can use quotes around it to prevent SAS from attempting to parse the vol id as multiple tokens. This option is valid only when it follows LABEL=SL.


Details

The LIBNAME statement can also list or clear librefs. See SAS Language Reference: Dictionary for information about using the LIBNAME statement for these purposes.

You can use the LIBNAME statement to list attributes of SAS data libraries. The following output example shows the results of the following LIBNAME statement:

libname sashelp list;

Data Library Attributes Listed by the LIBNAME Statement
   NOTE: Copyright (c) 1989-1999 by SAS Institute Inc., Cary, NC, USA.
   NOTE: SAS (r) Proprietary Software Release 7.01  TSxxx
     Licensed to SAS INSTITUTE DATA CENTER, Site xxxxxxxxx.
   NOTE: Running on IBM Model 3090 Serial Number xxxxxx.

   1    libname sashelp list;
   NOTE: Libref=   SASHELP
     Engine=   V8
     Filefmt=  701
     Physical Name= SAS4HELP SG
   NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414


See Also


Chapter Contents

Previous

Next

Top of Page

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