Valid in: | Anywhere |
Category: | Program Control |
Alias: | %INC |
See: | %INCLUDE Statement under Windows , UNIX , and z/OS |
Including external sources is useful in all types of SAS processing: batch, windowing, interactive line, and noninteractive.
n | includes line n. |
n-m or n:m | includes lines n through m. |
Use a %LIST statement to determine the line numbers that you want to include.
Although you can use the %INCLUDE statement to access previously submitted lines when you run SAS in a windowing environment, it might be more practical to recall lines in the Program Editor with the RECALL command and then submit the lines with the SUBMIT command.
proc print; %include *; run;To resume processing the original source program, enter a %RUN statement from the keyboard.
Use this argument to include source from the keyboard:
You can use a %INCLUDE * statement in a batch job by creating a file with the fileref SASTERM that contains the statements that you would otherwise enter from the keyboard. The %INCLUDE * statement causes SAS to read from the file that is referenced by SASTERM. Insert a %RUN statement into the file that is referenced by SASTERM where you want SAS to resume reading from the original source.
The SOURCE2 system option produces the same results. When you specify SOURCE2 in a %INCLUDE statement, it overrides the setting of the SOURCE2 system option for the duration of the include operation.
S | sets S2 equal to the current setting of the S= SAS system option. |
0 | tells SAS to use the setting of the SEQ= system option to determine whether the line contains a sequence field. If the line does contain a sequence field, SAS determines line length by excluding the sequence field from the total length. |
n | specifies a number greater than zero that corresponds to the length of the line to be read, when the file contains fixed-length records. When the file contains variable-length records, n specifies the column in which to begin reading data. |
Fixed-length records are either unsequenced or sequenced at the end of each record. For fixed-length records, the value given in S2= is the ending column of the data.
Variable-length records are either unsequenced or sequenced at the beginning of each record. For variable-length records, the value given in S2= is the starting column of the data.
data report;
infile file-specification;
input month $ salesamt $;
run;
proc print;
%include *;
run;