Language Reference

PACKAGE LIBNAME Statement

  • PACKAGE LIBNAME libref packagename;

This statement is supported only by the IML procedure.

The PACKAGE LIBNAME statement creates a SAS libref that points to the data directory for a package. You must load a package before you can use the PACKAGE LIBNAME statement.

You must specify the following arguments:

libref

specifies the name of a SAS libref to be created.

packagename

specifies the name of the package.

The PACKAGE LIBNAME statement is used to access data in a package. For examples, the following statements read data from the AboveBelow package, which is installed in the SYSTEM collection:

package load AboveBelow;
package libname ABdata AboveBelow;
/* use the libref to read data that the package provides */
use ABdata.example;
   read all var _NUM_ into X[colname=varNames];
close ABdata.example;
print varNames;

Figure 306: Reading Data from a Package

varNames
x1x2x3


The READ statement reads the numerical variables into the matrix bold upper X. Figure 306 shows that the example data set contains numerical variables named x1, x2, and x3.

You must specify exactly one package in the PACKAGE LIBNAME statement.

Last updated: July 20, 2026