After you have permanently
stored an informat or format, you can use it in later SAS sessions
or jobs. If you associate permanent informats or formats with variables
in a later SAS session or job, then SAS must be able to access the
informats and formats. Thus, you must use a LIBNAME statement to
assign a libref to the library that stores the catalog that stores
the informats or formats.
SAS uses one of two
methods when searching for user-defined formats and informats:
-
By default, SAS always searches
a library that is referenced by the LIBRARY libref for a FORMATS catalog.
If you have only one format catalog, then do the following:
-
Assign the LIBRARY libref
to a SAS library in the SAS session in which you are running the PROC
FORMAT step.
-
Specify LIBRARY=LIBRARY
in the PROC FORMAT statement. PROC FORMAT stores the informats and
formats that are defined in that step in the LIBRARY.FORMATS catalog.
-
In the SAS program that
uses your user-defined formats and informats, include a LIBNAME statement
to assign the LIBRARY libref to the library that contains the permanent
format catalog.
-
If you have more than one format
catalog, or if the format catalog is named something other than FORMATS,
then do the following:
-
Assign a libref to a
SAS library in the SAS session in which you are running the PROC FORMAT
step.
-
Specify LIBRARY=
libref or
LIBRARY=
libref.catalog in the
PROC FORMAT step, where
libref is
the libref that you assigned in step 1.
-
In the SAS program that
uses your user-defined formats and informats, use the FMTSEARCH= option
in an OPTIONS statement, and include
libref or
libref.catalog in
the list of format catalogs.
The syntax for specifying
a list of format catalogs to search is
OPTIONS FMTSEARCH=(catalog-specification-1<… catalog-specification-n>);
Each
catalog-specification can
be
libref or
libref.catalog.
If only
libref is specified,
then SAS assumes that the catalog name is FORMATS.
When searching for a
format or informat, SAS always searches in WORK.FORMATS first, and
then LIBRARY.FORMATS, unless one of them appears in the FMTSEARCH=
list. SAS searches the catalogs in the FMTSEARCH= list in the order
in which they are listed until the format or informat is found.