%INCLUDE Statement: z/OS

Includes SAS statements and data lines.
Valid in: Anywhere
z/OS specifics: file-specification, JCLEXCL, options
See: %INCLUDE Statement in SAS Statements: Reference

Syntax

%INCLUDE source-1 <. . . source-n >
</<SOURCE2> <S2=length> <S2V=column> <JCLEXCL>
<ENCODING='encoding-value'> <host-options> >
;

Required Arguments

The following list explains some of the components of the %INCLUDE statement. For complete syntax information, see %INCLUDE Statement in SAS Statements: Reference in the SAS Statements: Reference.

source
describes the location of the information that you want to access with the %INCLUDE statement. Here are the three possible sources:
file-specification
Under z/OS, this value can be a fileref or a physical filename enclosed in quotation marks. If you specify a fileref that is not allocated, then SAS attempts to construct a data set name with the following three qualifiers:
  • the value of the SYSPREF= option (usually the user ID)
  • the specified fileref
  • SAS
If a file is found that has this constructed data set name, then SAS opens it and reads it.
internal-lines
You can access lines that were entered earlier in the same SAS job or session. In order to use this technique in a line mode session, the SAS system option SPOOL must be in effect.
keyboard-entry
You can enter the statements or data lines directly from the terminal. Use an asterisk (*) to indicate that the statements are to come from the terminal.
SOURCE2
causes the SAS log to show the source statements that are being included in your SAS program. In other words, this option has the same effect as the SAS system option SOURCE2, except that it applies only to the records that you are currently including. Specifying SOURCE2 in the %INCLUDE statement works even if the NOSOURCE2 system option is in effect.
S2=length
specifies the length of the record to be used for input. Here are the possible values:
S sets S2 equal to the current setting of the SAS system option S=.
0 specifies to use the setting of the SAS system option SEQ= to determine whether the line contains a sequence field. If the line does contain a sequence field, SAS determines the line length by excluding the sequence field from the total length.
n indicates which columns SAS should scan and which columns, if any, contain sequence numbers that should be ignored. n specifies the column in which to start scanning (for variable-length records) or stop scanning (for fixed-length records).
If the source lines in an external file that you are including contain sequence numbers, then either delete them before including the SAS program in your SAS session, or specify S2=0. The maximum line length is 6K bytes.
S2V=column
specifies which column to use to begin scanning text from secondary source files that have a variable record format. The default value is S2. Here are the possible values:
S2 specifies to use the value of the S2=system option to compute the column to begin scanning text that comes from a %INCLUDE statement, an autoexec file, or an autocall macro file.
S specifies to use the value of the S=system option to compute the column to begin scanning text that comes from a %INCLUDE statement, an autoexec file, or an autocall macro file.
n specifies to use the value of n to compute the column to begin scanning text that comes from a %INCLUDE statement, an autoexec file, or an autocall macro file. The value for n can range from 0 to 2147483647.
JCLEXCL
ignores any lines of JCL in the included source.
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.
For valid encoding values, see Overview to SAS Language Elements That Use Encoding Values in SAS National Language Support (NLS): Reference Guide and SBCS, DBCS, and Unicode Encoding Values for Transcoding Data in SAS National Language Support (NLS): Reference Guide.
host-options
consists of statement options that are valid under z/OS. The following options are available:
  • BLKSIZE=block-size
    BLK=block-size
  • LRECL=record-length
  • RECFM=record-format