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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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