A common problem is transferring data from one statistical package to another. This FAQ shows how you can convert a SAS version 8 file to an SPSS file (using SPSS version 11 and above).
Example 1.
Say that you have a SAS data file called auto.sas7bdat that is located on your computer in a folder called c:dissertation. You can simply select File then Open and then for Files of Type select SAS Long File Name (*.sas7bdat) and then point to, for example, c:dissertationauto.sas7bdat and it will read that file. However, you will not get the value labels.
After converting the file, it is prudent to verify that the conversion was successful. You can do this by examining the SAS file using proc contents, proc means and proc print and then examining the SPSS file using display dictionary, descriptives and list cases.
Example 2.
Say that you have a SAS data file called auto.sas7bdat that is located on your computer in a folder called c:dissertation . You can use the following SPSS program to read that file and save it as an SPSS data file called auto.sav in the same directory.
get sas data="c:dissertationauto.sas7bdat". save outfile="c:dissertationauto.sav".
After converting the file, it is prudent to verify that the conversion was successful. You can do this by examining the SAS file using proc contents, proc means and proc print and then examining the SPSS file using display dictionary, descriptives and list cases.
Example 3.
You might have a format file associated with auto.sas7bdat that contains labels for your variables (in SPSS terminology, value labels). Say your formats are stored in the same directory (i.e., c:dissertation), then you need to use SAS to convert your format file into a format that SPSS can understand using a program like the one below.
LIBNAME library "c:dissertation"; PROC FORMAT LIBRARY=library CNTLOUT=library.auto_fmt; RUN;
This example creates a file call c:dissertationauto_fmt.sas7bdat that contains the formats for your data file. You can then ask SPSS to try to include those formats in your SPSS file using the program shown below.
get sas data="c:dissertationauto.sas7bdat" /formats="c:dissertationauto_fmt.sas7bdat". save outfile="c:dissertationauto.sav".
We say that SPSS will "try" to include the formats because not all SAS formats are compatible with SPSS formats. For example, SPSS does not allow formats for character variables (so any SAS formats for character variables will be ignored). For more information about the kinds of formats that cannot be converted, see the SPSS online documentation about the get sas command.