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

See Also


%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.

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.


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


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


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.


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


default format (same as variable).


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


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


print format.


variable format. Each record ends with a newline character.


variable S370 record format (V).


variable block S370 record format (VB).


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.


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]


Suppose you have issued the following FILENAME statement:

filename mypgm '[mydir]';

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