Discover More Tips and Techniques on This Blog

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.

1 comment:

Disclosure:

In the spirit of transparency and innovation, I want to share that some of the content on this blog is generated with the assistance of ChatGPT, an AI language model developed by OpenAI. While I use this tool to help brainstorm ideas and draft content, every post is carefully reviewed, edited, and personalized by me to ensure it aligns with my voice, values, and the needs of my readers. My goal is to provide you with accurate, valuable, and engaging content, and I believe that using AI as a creative aid helps achieve that. If you have any questions or feedback about this approach, feel free to reach out. Your trust and satisfaction are my top priorities.