BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vulpeszerda
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

6 REPLIES 6
Shmuel
Garnet | Level 18

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.

vulpeszerda
Fluorite | Level 6
Thank you!
Tom
Super User Tom
Super User

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.

vulpeszerda
Fluorite | Level 6
Thank you! I am actually quite content not seeing the formatted values in this case, I am only working with a tiny fraction of the variables and have memorized their formats 🙂
ballardw
Super User

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.

vulpeszerda
Fluorite | Level 6
Thank you, this is what I ended up doing.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2445 views
  • 0 likes
  • 4 in conversation