I received data from a contractor recently that had format catalogues attached for each dataset. I've found that when there's more than one catalogue in a folder, SAS can't access either of them. Is there a particular reason for this, or is this a glitch? Also, is there a workaround for this, besides splitting each dataset into its own library and moving the associated catalogue with it?
Edit: Fixed the subject line. Not sure how I ended up with "PDF Multiple GMAPs into one Document"
Scify
The way you specified FMTSEARCH, SAS is looking for a catalog named TWOCATS.FORMATS. What is the name of the two catalogs?
Use TWOCATS.<catalogName> in FMTSEARCH for catalog names other than formats
Bruno
Yes. A rough of the code I have:
libname twocats "library-with-two-format-catalogues"; options fmtsearch=(main-library twocats); proc freq data=twocats.stuff; table var1; format var1 var1.; run;
produces:
ERROR: The format var1 was not found or could not be loaded.
To avoid the obvious follow-up: I've double checked, and the format is in the catalogue. Other formats (in either catalogue) are also not found.
Scify
The way you specified FMTSEARCH, SAS is looking for a catalog named TWOCATS.FORMATS. What is the name of the two catalogs?
Use TWOCATS.<catalogName> in FMTSEARCH for catalog names other than formats
Bruno
Your FMTSearch should look like:
options fmsearch=(twocats.catalog1 twocats.catalog2);
where catalog1 and catalog2 are replaced by the names of the actual catalogs in the library twocats.
I doubt that you have an actual library named main-library as well.
The FMTSEARCH doesn't seem to generate any errors with the syntax, just can't find format catalogs when attempting to use incorrect assignments.
You might want to use APPEND to add to your existing search path as well:
options append( fmtsearch (twocats.catalog1 twocats.catalog2));
So that any other libraries you have added to the search path are still valid.
The main-library bit was just pseudocode, because I ran into the problem of the fmtsearch option overwriting previous instances of itself.
I didn't know about the append option, though. Thanks. I've been having to remind my senior to include our primary format library whenever he runs the statement; it might be easier to just tell him to use append.
Append is what I would recommend. Actually if you can get an autoexec file running at start up add the library assignments and the format search path there so they are always available.
Note that the FMTSEARCH is an in order left to right search assignment. If you have the same format in different libraries the one encounterd in the first library found will be used.
I maintain 7 permanent libraries and associated formats. I have many formats/ informats that start with the name of the library (or first few characters) so that they don't conflict.
I also routinely build custom formats for adhoc projects and store the formats with the data.
I would recommend using the option CNTLOUT on the proc format statement to create a dataset of the format descriptions as that can be useful in rebuilding the formats or providing a way to share them with someone else.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: