Reading data sets
Wherever your data come from, when starting your analysis you will have to retrieve the data from a file (unless you have just entered them into the data editor). Many data (not least those you have entered yourself in SPSS earlier on) come in SPSS format, but SPSS may also read data that were stored by other software.
A special case are 'raw' data, i.e. data that come 'just' as numbers or characters in a plain file which often is called an ASCII or text file. This case is dealt with in the section Read Raw Data.
Reading a SPSS data set
If your data already have been saved as a SPSS system file (with extension ".sav"), the command for accessing the data is the GET FILE command.
GET FILE = 'd:\mydirectory\mysubdirectory\mydata.sav'.
where you have to fill in your directory and data set names. Be sure that if you have worked with a different file prior to this command, and you have modified this file, you have to SAVE this file if you wish to retain these modifications for further use. (On the other hand, if you have modified this file but the result was nonsense, the easiest way to deal with this is simply not to save this file.)
Sometimes you may wish not to read in all the variables from a data file. You may either indicate which variables you wish to keep or which variables to drop. Also, you may wish to rename one or more variables. Thus, a more elaborate example of the GET FILE command could look like this:
|GET FILE = 'd:\mydirectory\mysubdirectory\mydata.sav'|
|/ KEEP id var1 var15 var17 var88|
|/ RENAME (var17 var88 = var16 var17).|
Here, the five variables mentioned after keyword KEEP will be read into your working file; var17 and var88 will be renamed to var16 and var17, respectively. If you want to keep most of the variables in the data file, the DROP command, indicating which variables are not to be read, will be more appropriate.
Reading data sets that come in other formats
SPSS can read data that were created with the help of other software; this may be another statistical package such as STATA or SAS, but also spreadsheets like Excel™ or other software (e.g. dbASE™ or Lotus™).
I cannot keep track with all the changes; you may get an idead which files your current version of SPSS can read by using the menu system (the best way is to make the data editor your front window and to click on the "open file" icon; you may now click at "Dateityp/files of type" and see what SPSS has to offer. But once you know that a specific type of file can be read by SPSS, you may use a command line.
Here's an example for reading a Stata™ file:
GET STATA FILE = 'd:\mydirectory\mysubdirectory\mystatadata.dta'.
Things may be more complicated with other types of file; you may use the menu system and then paste the command into the syntax file.
Several data sets
As of version 14.0, there have been considerable changes in the way SPSS handles data files. Particularly, it is possible to have several files open at the same time. This applies also to data that were read into SPSS from other sources, e.g., to Excel ™ files. Of course, SPSS can still analyze only one data set at a time, but you now can switch more easily between analyses that are to be run on different files. A drawback is that you may have open more files than you would like to. That is, you may give some thought to closing files you do not need anymore.
Note: If you are reasonably sure that you normally will work with a single data set during one session, you may disable SPSS's ability to work with several data sets at a time. In order to do this, you have to click on "edit/Bearbeiten", then "options/Optionen". In section "General/Allgemein" you will find a box where you can tick "open only one dataset at a time/Jeweils nur ein Datenblatt öffnen". This will make SPSS return to its older habit of closing a data file whenever another data file is opened.
Open a data set and keep it open even if other data sets have been opened
GET FILE = 'd:\mydata\judges\judges1.sav'.
DATASET NAME file1.
The most recently opened file (here, 'judges1.sav') will become your working file. The next command is necessary if you want to keep this file even after you have opened more data sets. If you do not name the data set, it will 'disappear' once you open the next data set. (Of course, this may be exactly what you want.)
GET FILE = 'd:\mydata\judges\judges1.sav'.
DATASET NAME file1 WINDOW = FRONT.
will make the data window with 'judges1.sav' the foremost window on your screen.
Use a data set that has been opened earlier
If you have opened one or more other data set(s) in the meantime,
DATASET ACTIVATE file1.
will make file 'file1' (that is, 'judges1.sav') your working file again.
Close a data set you do not need anymore
DATASET CLOSE file1.
© W. Ludwig-Mayerhofer, IGSW | Last update: 20 Jun 2009