Search This Blog

Loading...

Sunday, February 7, 2010

ERROR: The format XXXX was not found or could not be loaded.

Whenever you try to open a SAS data set which has permanent formats, you will get the error message in the log file saying

“ERROR: The format XXXX was not found or could not be loaded.”

This happens generally when you don't have the format library where the SAS dataset located. What happens here is, SAS will not permit you to open the data set without the format library.

But, if you use options nofmterr; at the top of your program, SAS will opens the dataset for you despite the fact that it does not have the format library.

SAS doesn't treat missing format or informat as an error when the options nofmterr; statement used.


The FMTERR\NOFMTERR option determines whether or not SAS generates an error message when a variable's format cannot be found. (source: support.sas.com)
The caveat here is, you will not be able to see the formatted values for your variables, but you will be able to open or use the dataset.

OPTIONS nofmterr;
*you will not be able to see the formatted values for your variables;

If you want to see the formatted values for the variables, you need to use AUTOEXEC.sas program.
Autoexec.sas program uses fmtsearch option which will tell SAS to look for formats in the assigned Formats library. This works great if I want to first open SAS, and then open a dataset.

AUTOEXEC.sas Program:
** Location of formats catalog **;
specify location of formats folder inside the libname statement.

libname frmtdir "C:\Documents and Settings\sreddy\Desktop\studyfolder";
options fmtsearch=(WORK frmtdir library);

When you submit above code, SAS will search for formats first in the work library, then in the format directory (fmtdir) and then in the default SAS library.


Permanent formats can be accessed with LIBREF LIBRARY directly, while FMTSEARCH option needs to be specified with user-defined LIBREF.

0 comments:

Post a Comment

ShareThis