Importing ICPSR SPSS Portable Files into SPSS Data Files

For most of the studies in the ICPSR's archive, the data are distributed in the form of large ASCII files with SPSS (or SAS) programs ("setup files," in the ICPSR's terms) that take the ASCII data and turn them into SPSS (or SAS) data files. For a growing number of studies, however, the ICPSR is providing an SPSS portable file for download. An SPSS portable file, which will have a .por extension, is an SPSS data file that (at least in theory!) can be read by different versions of SPSS and on different operating systems such as Macintosh or UNIX. In such situations, all you need to do is to download the SPSS portable file from the ICPSR website, import it into SPSS, and save it as an SPSS data file with a .sav extension. How, then, does one import a portable data file into SPSS? Read on ...

Here, we are using ICPSR #4262 for illustrative purposes:



Click here for full-size image

Click on the "Download Data" tab. You will be taken to the ICPSR MyData Login page. All ICPSR users are required to have accounts if they wish to download data, so you will need to set one up if you do not have one already. Enter your email address and password and, once you have been authenticated, you will see something like the following screen:



Click here for full-size image

The ICPSR presents users with multiple options for downloading data. Generally speaking, the ICPSR will have files available for different statistical packages. Here, for instance, there are ASCII data and setup files available for SAS, SPSS, and Stata as well as a SAS "transport" file, an SPSS portable file, and a Stata data file. [You can get additional detail about the files available for a study by reading the file manifest that is available on the "Description" page.] You can download just those files for a particular program (e.g. "ASCII Data File and SPSS Setup Files" or "SPSS Portable File") or download all the available files for a particular study. Whichever files you select will then be added into your "data cart" for download. If you go the data-cart route, you will be downloading a zipped archive of whatever files you chose. Alternately, you can click on the "download individual files" link at the file and download files one at a time. For our purposes, we only want the SPSS portable file, so we will choose this last route. Click on the "download individual files" link and you will taken to this page:



Click here for full-size image

If you scroll down, you will see a full list of the files available for your study. And, in our study here, we can see that there is an SPSS portable file available and ready to download.



Click here for full-size image

Now we can save the SPSS portable file. First, right click on the "SPSS portable" link and choose "Save Target As...":



Click here for full-size image

Save the SPSS Portable file in the desired location in your computer. For our example here, we're saving all our files to "C:\patrons\oelgun\STATA_and_SPSS_tutorials\ICPSR_4262_data\4262". Be sure to add ".por" to the end of the filename - the "Save as Type" field should be "All Files" Here, we'll save the data file as "sp4262-Data.por":



Click here for full-size image

[Note that, when we are saving the file, we are not using the default file name (i.e. 04262-0001-Data.por) that the ICPSR assigns. Instead, we are using an older ICPSR convention for naming files, mainly because the resulting file name is shorter. How you wish to name the files is up to you - just be careful about what file extension you specify.]

Now we can open the SPSS portable file in SPSS and save it as a "regular" SPSS data file with a .sav extension. In order to do so, open SPSS, click on the "File" menu, click on "Open", and then choose the "Data..." option.



Click here for full-size image

Now, you can open the SPSS portable file that you just saved. Go to the location you saved the SPSS portable file. When you go to the folder you saved the SPSS portable file you might not initially see your file. This is because, by default, SPSS looks for files with a .sav extension:



Click here for full-size image

In order to find the SPSS portable file you saved, you need to change the file type to "SPSS Portable (*.por)", which will display only SPSS portable files. Once you find the SPSS portable file you are looking for, highlight it and click on "Open":



Click here for full-size image

Once you open the portable file, the data will be displayed in SPSS' Data Editor:



Click here for full-size image

Now, all you have to do this save this file as an SPSS data file with a .sav extension. Just go to the "File" menu and select "Save As..."



Click here for full-size image

Type the name you want to give the file. In the example we have below, we have kept the same file name. However, it is essential to change the file extension from .por to .sav in order to save it in an SPSS data file format. So, make sure the file type you save the data file as is "SPSS (*.sav")":



Click here for full-size image

Now we have an SPSS data file, sp4262-Data.sav, which we can analyze with SPSS software:



Click here for full-size image

If you rely on SPSS syntax files when working with SPSS, you can also create (or modify) a syntax file to read in portable files and save them as "regular" data files using SPSS' IMPORT command. You can create a new SPSS syntax file by clicking on the "File" menue in the Data View window, choosing "New", and then choosing "Syntax":



Click here for full-size image

A window with a blank SPSS syntax file will then appear:



Click here for full-size image

In this syntax file, type something along the lines of the following:

IMPORT FILE = "portable-file-location-and-name".
SAVE OUTFILE = "data-file-location-and-name".
EXECUTE.

Example:

IMPORT FILE = "C:\patrons\oelgun\STATA_and_SPSS_tutorials\ICPSR_4262_data\4262\sp4262-Data.por".
SAVE OUTFILE = "C:\patrons\oelgun\STATA_and_SPSS_tutorials\ICPSR_4262_data\4262\sp4262-Data.sav".
EXECUTE.



Click here for full-size image

The IMPORT command will look for the data file that you identified in the location you specified and will "import" it into SPSS. The SAVE OUTFILE command will save the portable file as a new SPSS data file at the location you specified and with the name you specified. Once again, pay attention to the file extensions here - SPSS portables files have a .por extension, while SPSS data files used for analysis have a .sav extension. "EXECUTE" will then tell SPSS to actually implement the above commands. To run this command file, click on the "Run" menu at the top of the syntax editor window and choose the "All" option:



Click here for full-size image

You will then have an SPSS data file in the Data View window:



Click here for full-size image

To learn more about the syntax for these SPSS commands, you can use SPSS' internal syntax reference guide, which is available in SPSS. Click on the "Help" menu in SPSS' Data Editor and then choose "Command Syntax Reference" and the syntax reference guide will appear as a (very large) .pdf file:



Click here for full-size image

Click here for full-size image

You can then search or browse for a particular command (e.g. the IMPORT command) to get a more detailed description of its functions, options, and syntax rules:



Click here for full-size image




Data Analysis

Page adapted from Electronic Data Center, Emory University Libraries
Original text by Özlem Elgün