Chapter Contents

Previous

Next
%INCLUDE

%INCLUDE



Includes SAS statements and data lines

Language element: statement
Valid: anywhere in a SAS program
OpenVMS specifics: valid values for source, if a file specification is used


Syntax
Details
Example
See Also

Syntax

%INCLUDE source-1 < . . . source-n>
</option-list>;

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 keyboard entry. The file specification can be any of the file specification forms discussed in Identifying External Files to the SAS System.

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.

option-list
specifies portable options for the %INCLUDE statement. For more information about these options, see the %INCLUDE statement in SAS Language Reference: Dictionary. The %INCLUDE statement has no options that are host-specific for the OpenVMS environment.


Details

When you execute a program that contains the %INCLUDE statement, the SAS System 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 running SAS in interactive line mode, noninteractive mode, or batch mode. Although you can use the %INCLUDE statement when running SAS using windows, it may 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.


Example

The following is an example of a %INCLUDE statement. 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


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.