Packages(Experimental)


Using a Package

Before you can use a package, it must be installed, as described in the section Installing, Loading, and Uninstalling a Package.

Usually a package provides definitions of SAS/IML modules. To use a package, use the PACKAGE LOAD statement to load the module definitions. The following statement loads the AboveBelow package, which is distributed as part of SAS/IML software:

package load AboveBelow;

If the package includes a data directory, you can use the PACKAGE LIBNAME statement to create a libref that points to the data directory. (If the package does not include a data directory, the PACKAGE LIBNAME statement generates an error.) The following statements assign the libref ABDATA to point to the data directory for the AboveBelow package. The USE and READ statements read the data into the matrix A.

package libname abdata AboveBelow;
use abdata.example; read all var _NUM_ into A; close;

Loading a package defines all modules and variables in the package. (Use the PACKAGE HELP statement to view the module syntax, as shown in the section Displaying Information about Installed Packages.) The following statements call a module in the AboveBelow package and run it on the example data. Figure 9.4 illustrates the data and the module’s output, which shows the numbers of negative values, zero values, positive values, and missing values for each of the three columns of the data matrix.

print A;
run PrintAboveBelow(A);    /* call module in package */

Figure 9.4: Matrix and Result of Calling a Module in the AboveBelow Package

A
. -9 -8
-7 0 .
0 . .
-1 0 1
0 3 4
5 6 0

Counts
Negative 2 1 1
Zero 2 2 1
Positive 1 2 2
Missing 1 1 2



In a similar way, you can call other functions in the AboveBelow package.


Note: This procedure is experimental .