Previous Page | Next Page

Statements under z/OS

%INCLUDE Statement: z/OS

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



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

The following list explains some of the components of the %INCLUDE statement. See SAS Language Reference: Dictionary for the complete syntax information.


describes the location of the information that you want to access with the %INCLUDE statement. Here are the three possible sources:


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.

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.


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.


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.


specifies the length of the record to be used for input. Here are the possible values:


sets S2 equal to the current setting of the SAS system option S=.


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.


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.


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:


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.


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.


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.


ignores any lines of JCL in the included source.


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 Encoding Values in SAS Language Elements in SAS National Language Support (NLS): Reference Guide.


consists of statement options that are valid under z/OS. The following options are available:

  • BLKSIZE=block-size


  • LRECL=record-length

  • RECFM=record-format

For more information about host-options, see Host-Specific Options for UNIX System Services Files and DCB Attribute Options.

Previous Page | Next Page | Top of Page