PACKAGE LOAD packagename<(collection <VERSION=version> )> …;
The PACKAGE LOAD statement is experimental in SAS/IML 14.1. The PACKAGE LOAD statement executes the package source files. Usually the source files define SAS/IML modules. However, a package might also define SAS/IML matrices, create data sets, define macro variables, or carry out a computation.
You must specify the following argument:
You can also specify the following options in parentheses:
The following statement loads the AboveBelow package, which is installed in the SYSTEM collection:
package load AboveBelow;
The PACKAGE LOAD statement reads the info.txt
file and uses the SourceFiles keyword to determine which files contain the source code for the package. (For more information
about the info.txt
file, see the section Step 2: Create the Package Information File.) The statement executes the specified files, which are located in the
source
directory of the package’s root directory. For the AboveBelow package, the PACKAGE LOAD statement defines several SAS/IML
modules. The SAS Log window indicates that new modules were defined.
As a second example, the following PACKAGE LOAD statement loads a package called Pkg1
from the PUBLIC collection. The load succeeds if the installed version of the package is greater than or equal to version
1.2, but it fails if the installed version of the package is less than 1.2. For example, the load succeeds if the installed
version is 1.2, 1.3, or 2.1. The load fails if the installed version is 1.1.
package load Pkg1(public version="1.2");
The PACKAGE LOAD statement is similar to the EXECUTEFILE subroutine but differs in the following ways:
The PACKAGE LOAD statement can execute multiple files. The EXECUTEFILE subroutine executes a single file.
The PACKAGE LOAD statement keeps track of which packages have been loaded. A subsequent PACKAGE LOAD statement does not reread and rerun the package source files. In contrast, the EXECUTEFILE subroutine rereads and reruns the file every time it is called.
The IMLPlus language in the SAS/IML Studio application executes the PACKAGE LOAD statement at parse time. That is, SAS/IML Studio reads the source files and defines the modules before it executes any statements.