DATA Step, Macro, Functions and more

Format was not found or could not be loaded after using options fmtsearch=

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Format was not found or could not be loaded after using options fmtsearch=

Hello,

 

I run into a problem when I reopened SAS. The format which can be loaded previously can not be loaded any more. I specify the libname for the formats and I can find and open them in SAS explorer. I used options fmtsearch= . However, when I try to set a dataset into another dataset, it always said "Format was not found or could not be loaded". 

 

libname fmt 'C:\Users\hli\Desktop\work\project\HealthABC\Data\Formats';

libname PH 'C:\Users\hli\Desktop\work\project\HealthABC\Data\PH';

options fmtsearch=(fmt) ;

data ph;
set PH.ph;
keep HABCID HCFAID DOB RACE GENDER SITE VSTATUS DOD CV3DATE VITAL06M VITAL36M DTLASTCT LASTCTYP CV1AGE CV3AGE;
run;

ERROR: The format RACE was not found or could not be loaded.
ERROR: The format GENDER was not found or could not be loaded.
ERROR: The format SITE was not found or could not be loaded.
ERROR: The format STATUS was not found or could not be loaded.
ERROR: The format VTYPE was not found or could not be loaded.
...

 

Does anyone know the reason? Thank you.


Accepted Solutions
Solution
‎06-01-2017 01:52 PM
Super User
Super User
Posts: 7,076

Re: Format was not found or could not be loaded after using options fmtsearch=

[ Edited ]

You can also use the full name of the catalog in your FMTSEARCH option instead of just giving it a libref.  If you only give it a one level name then it assumes you want the FORMAT catalog in that library.

 

ibname fmt 'C:\Users\hli\Desktop\work\project\HealthABC\Data\Formats';
libname PH 'C:\Users\hli\Desktop\work\project\HealthABC\Data\PH';
options fmtsearch=(fmt.formats64) ;

View solution in original post


All Replies
Super User
Posts: 3,260

Re: Format was not found or could not be loaded after using options fmtsearch=

Check your folder C:\Users\hli\Desktop\work\project\HealthABC\Data\Formats for a file called formats.sas7bcat. If it doesn't exist then you will need to re-create your formats in that folder.

Occasional Contributor
Posts: 11

Re: Format was not found or could not be loaded after using options fmtsearch=

I do have all the formats on file...

PROC Star
Posts: 7,491

Re: Format was not found or could not be loaded after using options fmtsearch=

Explain what you mean "that you have them on file."

 

When you compiled them did you assign your format library to them. e.g.,

libname art '/folders/myfolders';
libname fmt '/folders/myfolders/formats';
proc format library=fmt;
  value $sex
  'M'='Male'
  'F'='Female'
  ;
  value age
  1-14=younger
  15-20=young
  ;
run;
options fmtsearch=(fmt) ;
data art.want;
  set sashelp.class;
  format age age.;
  format sex $sex.;
run;
data want;
  set art.want;
run;

Art, CEO, AnalystFinder.com

Occasional Contributor
Posts: 11

Re: Format was not found or could not be loaded after using options fmtsearch=

I have a bunch of formats that are in .xpt format and I transfered them to SAS format. So I don't need to create any formats myself. However, somehow the formats cannot be loaded.

PROC Star
Posts: 7,491

Re: Format was not found or could not be loaded after using options fmtsearch=

You have to convert them. An example can be found at: https://communities.sas.com/t5/Base-SAS-Programming/Convert-XPT-to-SAS-Datasets/td-p/97872

 

Art, CEO, AnalystFinder.com

 

Occasional Contributor
Posts: 11

Re: Format was not found or could not be loaded after using options fmtsearch=

I converted them. Right now, I have the SAS format in my specified folder. It actually worked after I transferred them, however, I closed the program. When I opened the program again, the format cannot be loaded any more.

PROC Star
Posts: 7,491

Re: Format was not found or could not be loaded after using options fmtsearch=

Did you reassign the library and include it with the fmtserach option? If you always want those formats to be used you can include those assignments in your config file.

 

Art, CEO, AnalystFinder.com

 

Super User
Posts: 7,854

Re: Format was not found or could not be loaded after using options fmtsearch=


Heraaaa wrote:

I converted them. Right now, I have the SAS format in my specified folder. It actually worked after I transferred them, however, I closed the program. When I opened the program again, the format cannot be loaded any more.


Then there is something happening that removes the formats from the FMT library, or you are missing the necessary options fmtsearch= in your code.

 

Since I guess you use SAS with the Display Manager, you can use the SAS explorer to view the FORMATS catalog in the FMT library for its contents.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Trusted Advisor
Posts: 1,584

Re: Format was not found or could not be loaded after using options fmtsearch=

Posted in reply to KurtBremser

plaese post:

1) The code you used to convert the .xpt file into sas formats ? 
    Can it be that the formats were saved to work.formats catalog ?

 

2) Please run next code and check are those formats realy exist in TEST deataset:

     

libname fmt 'C:\Users\hli\Desktop\work\project\HealthABC\Data\Formats';

proc format lib=fmt cntlout=test; run;
Occasional Contributor
Posts: 11

Re: Format was not found or could not be loaded after using options fmtsearch=

Thank you all. I figured it out. In my format library, the formats are called formats64 (I named it when I imported them). After I changed the name to formats, the formats can be loaded.

Solution
‎06-01-2017 01:52 PM
Super User
Super User
Posts: 7,076

Re: Format was not found or could not be loaded after using options fmtsearch=

[ Edited ]

You can also use the full name of the catalog in your FMTSEARCH option instead of just giving it a libref.  If you only give it a one level name then it assumes you want the FORMAT catalog in that library.

 

ibname fmt 'C:\Users\hli\Desktop\work\project\HealthABC\Data\Formats';
libname PH 'C:\Users\hli\Desktop\work\project\HealthABC\Data\PH';
options fmtsearch=(fmt.formats64) ;
Occasional Contributor
Posts: 11

Re: Format was not found or could not be loaded after using options fmtsearch=

Thank you!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 401 views
  • 0 likes
  • 6 in conversation