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

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"

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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

View solution in original post

6 REPLIES 6
BrunoMueller
SAS Super FREQ

Have you tried the FMTSEARCH System option?

 

Bruno

scify
Obsidian | Level 7

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. 

BrunoMueller
SAS Super FREQ

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

ballardw
Super User

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.

scify
Obsidian | Level 7

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.

ballardw
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3463 views
  • 1 like
  • 3 in conversation