Previous Page | Next Page

Statements under OpenVMS

%INCLUDE Statement: OpenVMS



Includes SAS statements and data lines.
Valid: anywhere in a SAS program
OpenVMS specifics: valid values for encoding-value and source, if a file specification is used
See: %INCLUDE Statement in SAS Language Reference: Dictionary

Syntax
Details
Example
See Also

Syntax

%INCLUDE source-1 < . . . source-n></<ENCODING='encoding-value'><host-options>>;

source-1 < . . . source-n>

describes the location of the information that you want to access with the %INCLUDE statement. The three possible sources are an external file specification, previously entered SAS statements from your SAS session, or a keyboard entry. The file specification can be any of the file specification forms discussed in Identifying External Files to SAS.

Note:   When you use aggregate syntax and the member name contains a leading digit, enclose the member name in quotation marks. If the member name contains a macro variable reference, use double quotation marks.  [cautionend]

This section discusses only external file specifications. For information about including lines from your terminal or from your SAS session, see Recalling SAS Statements and the SAS statements portion of SAS Language Reference: Dictionary.

Restriction: The maximum line length is 32K bytes.
ENCODING='encoding-value'

specifies the encoding to use when reading from the specified source. The value for ENCODING= indicates that the specified source has a different encoding from the current session encoding.

When you read data from the specified source, SAS transcodes the data from the specified encoding to the session encoding.

For valid encoding values, see Encoding Values in SAS Language Elements in SAS National Language Support (NLS): Reference Guide.

host-options

consists of statement options that are valid under OpenVMS. The following options are available:

BLKSIZE=block-size
BLK=block-size

specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.

LRECL=record-length

specifies the record length (in bytes). The value of record-length can range from 1 to 1,048,576 (1 megabyte). If LRECL= is not specified, SAS uses the value of the LRECL= system option.

RECFM=record-format

controls the record format. The following values are valid under OpenVMS:

D

default format (same as variable).

F

fixed format. That is, each record is the same length.

N

binary format. The file consists of a stream of bytes with no record boundaries.

P

print format.

V

variable format. Each record ends with a newline character.

S370V

variable S370 record format (V).

S370VB

variable block S370 record format (VB).

S370VBS

variable block with spanned records S370 record format (VBS).

The S370 values are valid with files laid out as z/OS files only. That is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS file, first copy it to a variable-length, binary z/OS file.


Details

When you execute a program that contains the %INCLUDE statement, SAS executes your code, including any statements or data lines that you bring into the program with %INCLUDE.

The %INCLUDE statement is most often used when you are running SAS in interactive line mode, noninteractive mode, or batch mode. Although you can use the %INCLUDE statement when you are running SAS using windows, it might be more practical to use the INCLUDE and RECALL commands to access data lines and program statements, and submit these lines again.

The %INCLUDE statement executes statements immediately.

Note:   If you specify any options in the %INCLUDE statement, remember to precede the options list with a forward slash (/).  [cautionend]


Example

Suppose you have issued the following FILENAME statement:

filename mypgm '[mydir]program1.sas';

Then, in a SAS program you can issue the following %INCLUDE statement to copy in and execute the SAS statements stored in the file PROGRAM1.SAS:

%include mypgm;


See Also

Previous Page | Next Page | Top of Page