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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

12 REPLIES 12
SASKiwi
PROC Star

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.

Heraaaa
Fluorite | Level 6

I do have all the formats on file...

art297
Opal | Level 21

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

Heraaaa
Fluorite | Level 6

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.

art297
Opal | Level 21

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

 

Heraaaa
Fluorite | Level 6

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.

art297
Opal | Level 21

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

 

Kurt_Bremser
Super User

@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.

Shmuel
Garnet | Level 18

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;
Heraaaa
Fluorite | Level 6

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.

Tom
Super User Tom
Super User

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) ;

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
  • 12 replies
  • 54870 views
  • 3 likes
  • 6 in conversation