PRACTICAL SOCIAL INVESTIGATION:

MANIPULATING AND SAVING DATA FILES IN SPSS FOR WINDOWS (Versions 8 and 10)

 

MANIPULATING OLD VARIABLES TO GENERATE NEW VARIABLES

Generating new variables by recoding existing ones is discussed within the page that describes the analysis of cross-tabulated data (crosanal.html).

Deriving new variables by combining information from more than one existing variable can be achieved within SPSS by clicking on Transform and then on Compute.... The resulting menu allows the researcher to enter the name of the new ('Target') variable, and to specify a formula ('Numeric Expression') for it (e.g. AGEDIFF = AGE - SPOUSAGE). Sometimes a researcher may want to compute a variable in different ways for different groups of respondents; this can be achieved by clicking on If... and specifying (an 'if condition' corresponding to) the group of respondents to whom a specific formula applies.

For example, the researcher might wish to use the formula AGEDIFF = AGE - SPOUSAGE if SEX = 1 and the formula AGEDIFF = SPOUSAGE - AGE if SEX = 2. She or he will thus need to use the Transform/ Compute... menu twice.

A careful examination of the frequencies of the newly derived variable and of its relationship to the original variables (e.g. via cross-tabulations) is important, as it is easy to make mistakes when computing new variables; the presence of missing values or other distinctive values within the original variable(s) can also impact on the new variable.

Keeping a record of the ways in which new variables are derived is also crucial; it is useful to paste recoding and computing commands to an SPSS syntax window (see synwins.html) and to save the contents of this window for future reference or for re-usage. Experienced researchers often type recoding and computing commands directly into syntax windows.

 

SAVING (AN AMENDED VERSION OF) THE DATA FILE

A copy of the data, including any new recoded or derived variables, can be saved at the end of a session by (within the Data Editor) clicking on File and then on Save or on Save As..., depending on whether the researcher wants to update the old version of the data or to save a separate, new version of the data under a different name. As noted earlier, keeping a separate, ‘clean’ copy of the original system (data) file avoids a situation arising where amendments to the data lead to the irretrievable loss of some of the data in their original form.