How to convert an SPSS File to a SAS Data Set

For SPSS users on the U-system:

Step 1: Create the SPSS file in EXPORT format

SAS can read files created by SPSS if they are created in export format. System files created with the SAVE or XSAVE command in SPSS must be converted to export format before attempting to read them in SAS. To create an SPSS file in export format, use the EXPORT command in your SPSS program:

  
  EXPORT OUTFILE="myfile.por"

where "myfile.por" is the file in export format. Files of this type may be transferred between platforms with different operating systems. For instance, a portable file created by SPSS for Windows can be transferred to the U cluster and read in SAS (or SPSS) on that platform. If you need to transfer your SPSS portable file to another platform, you should use ASCII transfer, not binary.

Step 2: Read the SPSS system file into SAS

To read the file into a SAS dataset, you will need a libname statement which uses the SPSS engine. The following statements show how to take the SPSS export file created above and create a permanent SAS dataset called "mysasfile.sas7bdat" in the working directory.


  libname spsdat spss 'myfile.por' ;
  data 'mysasfile' ;
    set spsdat._first_ ;

The first LIBNAME statement uses the logical name "spsdat" to refer to the SPSS export file "myfile.por". Since the file is in SPSS export format, the spss engine is invoked.

The DATA statement names the permanent SAS dataset "mysasfile" and stores it in the current working directory.

The SET statement reads in the SPSS export file with the SPSS engine as required by the first LIBNAME statement. _first_ is used to refer to the file since it is the first data set in the library.

For PC Users with SPSS 12.0

Focus on the data spreadsheet, then click the File menu. Select Save As. In the Save as type window, select SAS v7+ for Windows long extension (*.sas7bdat). Do not pick any of the ssd or sd filetypes. This saves your file in SAS dataset format and it can be transferred directly to the U-system and used there or in the Windows version of SAS on your PC.