How do I use a SPSS data file in SAS?

1. Using SAS software

SAS 9.x supports SPSS data files (*.sav).  The following example shows how to use SAS proc import to read in a SPSS data file hsb2.sav.  It is advisable to check the log file and use proc contents to ensure the data have been read correctly. Notice that SAS recognizes the file type to be imported by file extension.

proc import datafile = "c:\data\hsb2.sav" out= work.hsb2;
run;
proc contents data=hsb2;
run;

2. Using SPSS software

SPSS supports SAS data files and can easily save an SPSS file as a SAS file through the point and click interface or syntax.  Using the pull-down menus select File then Save As... and then for Save as type select an appropriate SAS format, e.g., select SAS v7+ Windows Long File Extension (*.sas7bdat) for Windows machine.  Type the file name and click Save to save the SAS file.  To use SPSS syntax use the save translate command as seen below.

save translate outfile='C:\data\hsb2.sas7bdat'.
Data written to C:\data\hsb2.sas7bdat.
11 variables and 200 cases written.
[output omitted for space]

Note SPSS is also compatible with the following SAS extensions: (*.sd2), (*.sd7), (*.xpt) and (*.ssd01).

How to cite this page

Report an error on this page or leave a comment

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.