Hello,
I have converted some XPT files into SAS . The XPT files were downloaded from CASTOR EDC and encoded in UTF-8.
After conversion I cannot open my SAS files there is an error message 'SAS format could not be found or loaded...' (see attached doc)
Formats are available in a file called formats.sas7bcat. If I could import that file in my work environment, will be able to open the SAS files? If so, how could I do the import?
Kind Regards
Justine
To let you use the data without the special formats just tell SAS to ignore the missing formats by setting the NOFMTERR option.
If you have a format catalog then you can try to use it. (Note you do not "import" a format catalog anymore than you import a SAS dataset, you just use it as it is already a SAS file.) But remember that format catalogs are specific to the version of SAS and the type or operating system you are using. So the format catalog might be useless. If they used a transport file for the dataset then they should have used a transport file for the catalog also. It is hard to tell from your description what type of transport file you got for the dataset (the XPT extension is not tied to any particular type of file). If it was a file created by PROC CPORT then it could contain format catalogs in addition to datasets. But the version 5 XPORT format created by the XPORT libref engine (or the newer verison created by the SAS supplied macros) cannot contain catalogs.
To test the catalog place it one the computer where SAS is running and point a libref at the directory ("folder") where the catalog file lives. So if the file is named xxx.sas7bcat and your libref was named MYFMT then you could try running PROC FORMAT to see what is in it and test if SAS can use it.
proc format lib=myfmt.xxx fmtlib;
run;
The encoding of your sas session is utf-8, right?
@juju_p You may try adding options=nofmterr; in the data step when you read your data file to avoid that format error.
libname mylib "c:\the path to your data file";
data mydata;
set mylib.datafilename;
options=nofmterr;
run;
Then import your format file in LIBRARY.
libname library "c:\path to your format file";
Then you can access the value labels in your PROC steps.
proc freq data=mylib.mydata;
tables var1;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: