I have six large datasets stored in a library in SAS 9.4. Individually, each of them runs analyses fine without error. I am trying to combine them using a set statement, which I have done in the past. But this time, when I run the set statement, I get a couple hundred "ERROR: The format XYZ was not found or could not be loaded". It looks to me like the formats in the errors are for all the datsets, since some of them repeat six times and the datasets measure the same variables over time. Anyway, I am wondering why this would happen and what to do because it's stopping me from being able to combine these together. I know I must be missing something obvious, I'm sorry that I'm still very new to SAS and formats are something I have less understanding of. I have tried using Options fmtsearch, referring to the library where all of these datasets are together, but that doesn't work. My code/log is below but it's essentially what I just described. Any ideas? TYIA for any help.
Options fmtsearch=(hints);
data hints. hintsmerge;
set hints. temphints3 hints. temphints41 hints. temphints43 hints. temphints44 hints. temphints51 hints. temphints52;
run;
ERROR: The format XYZ was not found or could not be loaded.
.
.
.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set HINTS.HINTSMERGE may be incomplete. When this step was stopped there
were 0 observations and 1470 variables.
You can define datasets with formats "permanently" attached. What this actually means is just that in the metadata for the dataset is says what format you prefer to use to display the variable. But the actual format itself is stored in a format catalog, NOT in the dataset.
So if later you try to use the dataset and you have not told SAS where to find that format you get those errors.
You can set the option NOFMTERR to prevent SAS from stopping because of the missing formats.
options nofmterr;
Then at least your data step will run and you can use the data. But you will have to be content with seeing just the raw values displayed instead of the formatted values.
It looks like you are expecting that the libref HINTS contains a catalog named FORMATS that contains the XYZ format. Make sure that the HINTS libref is defined and that it has a catalog named FORMATS and that that catalog contains the formats you are looking for.
proc format fmtlib lib=hints;
run;
If it doesn't then look for the source code to define the formats and re-run it to create them.
You can run next code to check in which library is a format named XYZ:
proc sql;
select * from dictionary.catalogs
where objtype contains 'FORMAT'
and objname = 'XYZ';
quit;
then use options fmtsearch= to assign the library where that format exists.
You can define datasets with formats "permanently" attached. What this actually means is just that in the metadata for the dataset is says what format you prefer to use to display the variable. But the actual format itself is stored in a format catalog, NOT in the dataset.
So if later you try to use the dataset and you have not told SAS where to find that format you get those errors.
You can set the option NOFMTERR to prevent SAS from stopping because of the missing formats.
options nofmterr;
Then at least your data step will run and you can use the data. But you will have to be content with seeing just the raw values displayed instead of the formatted values.
It looks like you are expecting that the libref HINTS contains a catalog named FORMATS that contains the XYZ format. Make sure that the HINTS libref is defined and that it has a catalog named FORMATS and that that catalog contains the formats you are looking for.
proc format fmtlib lib=hints;
run;
If it doesn't then look for the source code to define the formats and re-run it to create them.
Work around while determining why you can't find the formats defined:
Options NOFMTERR;
Will turn off treating a missing format as an error and allow you to use the data sets. Just don't expect any of the missing formats to work. There will still be a note in the log about missing formats though.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.