IBM Support

How to create SAS formats files that can be read into SPSS using GET SAS

Question & Answer


Question

I'm using SPSS version 11.x or higher and I'm trying to import a SAS datafile along with its associated formats. I'm following Resolution 19610, which says I can "import [my] SAS formats if they are saved as a native SAS dataset file." It then shows some GET SAS command syntax that refers to a formats file with an extension of .sas7bdat. Every time I try to save out my SAS formats, I get a file with the extension .sas7bcat instead, and the import doesn't seem to work if I use that file. What can I do?

Answer

If your formats file has a .sas7bcat extension, then it's in the wrong format for the GET SAS command to be able to read it. The SAS file formats must be saved out of SAS as a regular data file with a .sas7bdat extension. The following is an example of how to do that, and should help with how to write the proper SAS PROC FORMATS statement.

How to save out SAS file formats so they can be read into SPSS:


1) Save SAS data file as usual.
2) Re-run the SAS program that creates the format library (formats.sas7bcat) and make 2 changes:

A) change the library assignment line

LIBNAME LIBRARY 'e:\userdata\folder\';

to another assignment

LIBNAME OUT 'e:\userdata\folder\';

B) change the proc format line from

PROC FORMAT LIBRARY=LIBRARY;

to

PROC FORMAT CNTLOUT=out.formats;

You should end up with a datafile containing your formats (formats.sas7bdat) instead of a format file (formats.sas7bcat).

(Note: The difference is in the end of the extension ***dat vs. ***cat.)

To read into SPSS, use the following command:

GET SAS DATA='E:\USERDATA\folder\dataset.sas7bdat'
/FORMATS = 'E:\USERDATA\folder\formats.sas7bdat'.

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

31951

Document Information

Modified date:
16 April 2020

UID

swg21477332