Help using Base SAS procedures

How to Read in Existing format?

Accepted Solution Solved
Reply
Contributor
Posts: 58
Accepted Solution

How to Read in Existing format?

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!


Accepted Solutions
Solution
‎09-26-2013 03:10 PM
SAS Employee
Posts: 4

Re: How to Read in Existing format?

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


All Replies
Solution
‎09-26-2013 03:10 PM
SAS Employee
Posts: 4

Re: How to Read in Existing format?

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

SAS Employee
Posts: 1

Re: How to Read in Existing format?

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

Super User
Posts: 5,503

Re: How to Read in Existing format?

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

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 376 views
  • 3 likes
  • 4 in conversation