Chapter Contents


SAS Companion for the CMS Environment

Identifying an External File

To identify the external file to SAS, use a file-specification argument in a SAS statement. The file-specification argument takes one of the following forms:

specifies the CMS fileid of the external file and has the following form:

'filename filetype <filemode | SFS-directory | *>'
This syntax can also be used to specify a MACLIB as an aggregate external file, as follows:

'filename MACLIB <filemode | *'>

To specify a CMS minidisk or SFS directory as an aggregate file, use the following:

'filemode | SFS-directory | *'

Omitting the filename and filetype specifies an aggregate file, which consists of an SFS directory or minidisk. Files in the directory or minidisk are accessed as independent members of the aggregate file.

If you omit filemode or SFS-directory, or if you specify an asterisk (*) when you reference the file for input, accessed disks are searched in the standard CMS search order, and the first occurrence of a file with a matching filename and filetype is read. If you omit filemode or SFS-directory, or if you specify an asterisk (*) when you reference the file for output, the file is written on the first R/W disk.

You cannot use an asterisk (*) for either filename or filetype.

specifies a logical name that is associated with an external file. This name contains 1 to 8 characters and is not enclosed in quotes. The first character must be a letter (A to Z or a to z) or an underscore (_); the remaining characters can be any combination of letter, numbers, or underscores. If a SAS FILENAME statement, FILENAME function, or CMS FILEDEF command has assigned this logical name to an external file, then the device or file that is identified by that FILENAME statement is used. If a FILENAME statement has not been issued, then SAS creates an assignment for the fileref by creating a CMS file specification, and SAS uses the fileref as the filename and defaults for filetype and filemode.

specifies an independent member of an aggregate file that was previously associated with the fileref.

Aggregate External Files

An aggregate external file is processed as a single file that contains multiple independent members. For input only, CMS MACLIBs can be specified as aggregate files. For input and update, an aggregate file can be an SFS directory or a CMS minidisk.

The FILENAME statement is used to specify an aggregate external file:

FILENAME fileref 'filename filetype filemode | SFS-directory | *';

Concatenating External Files

To concatenate external files or directories, use the FILENAME statement. To concatenate files that contain multiple SAS programs in order to invoke the programs in a single invocation, use the SYSIN= system option.

Aggregate Files Compared with Concatenated Files

Aggregate files contain independent files that are processed as individual members. Concatenated files appear to SAS as a single file that contains the data of all of the files that are listed in concatenation. In other words, concatenated files are not independent of each other. The order of the concatenation means that files that are listed first in the FILENAME concatenation take precedence over files that appear later in the list.

Aggregate files can be concatenated. SAS treats an aggregate concatenation as it does any other, by searching each aggregate in turn, in order of appearance, in the initial concatenation specification.

Chapter Contents



Top of Page

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