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!
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);
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);
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
If you want to see the contents of each format, add one word to the end of your PROC FORMAT statement: FMTLIB
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.
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.