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

Hello

So I just received a dataset with formats from someone. I can't seem to read in the formats.

I have received 2 files data.sas7bdat and formats.sas7bcat.

So I wrote the following code:

LIBNAME TCCTM 'C:\Data';

LIBNAME TCCTMFMT 'C:\Data';

proc format Library=TCCTMFMT.formats; run;

It ran with no error. But when I open up the dataset I get a series of "Errors: Format FORMAT1 not found or couldn't be loaded for variable VAR1."

I have also tried the CNTLIN command instead of the library command and I get the following error: ERROR: File TCCTM.FORMATS.DATA does not exist.

I did open the format file in SAS (using the SAS explorer), I see the FORMAT1 does exist in the file. So I am thinking I am reading in the format incorrectly. Can someone tell me how to do it correctly?

In addition, how can I tell what value is associated with each format? for example, if the format for education is 1=high school, 2=college 3=grad school.. I know with formats, I will only see the naming. How do I see numerical value associated with the format without removing the format?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
EM_sas
SAS Employee

You need to use the FMTSEARCH system option to specify the search order for format libraries if the format libraries are not in the Work library or the Library library.

Add this options statement :

options fmtsearch=(tcctm tcctmfmt);

View solution in original post

3 REPLIES 3
EM_sas
SAS Employee

You need to use the FMTSEARCH system option to specify the search order for format libraries if the format libraries are not in the Work library or the Library library.

Add this options statement :

options fmtsearch=(tcctm tcctmfmt);

jodilynne
SAS Employee

Try submitting the FMTSEARCH= system option as shown below in your SAS session before opening the data set in SAS Explorer.

LIBNAME TCCTM 'C:\Data';

options fmtsearch=(TCCTM);

SAS will now look in the TCCTM library for the format in the file: formats.sas7bcat and the formatted values should appear instead of the error when you attempt to open the data set from the Explorer window. For more helpful details about format catalogs, please see: Usage Note 37332: General information about storing and retrieving user-defined formats http://support.sas.com/kb/37332

Astounding
PROC Star

If you want to see the contents of each format, add one word to the end of your PROC FORMAT statement:  FMTLIB

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 13986 views
  • 3 likes
  • 4 in conversation