SPSS Tutorials


SPSS Datasets Tutorial 1 – Basics


SPSS dataset logic is not always logical. However, for working proficiently with datasets, just a handful of basics is sufficient. These are explained in this tutorial.

This tutorial focuses on working with SPSS datasets. For a definition and some background on datasets, see SPSS Datasets.

Working with SPSS Datasets

*Set working directory and open data file.

cd 'd:/downloads'.
get file 'idols.sav'.

Untitled Datasets

SPSS Untitled Dataset An Untitled Dataset in SPSS

Named Datasets

*Open idols.sav and apply name to dataset.

get file 'idols.sav'.
dataset name idols_data.

*Open service_provider.sav and apply name to dataset.

get file 'service_provider.sav'.
dataset name service_data.

*Compute test variable.

compute test_0 = 0.

Now you have two open datasets. The first didn't close upon opening the second because a name ("idols_data") was applied to it.

The Active Dataset

SPSS Active Dataset The Active Dataset in SPSS
*Compute test variable in idols_data.

dataset activate idols_data.
compute test_1 = 1.

Activating idols_data before the COMPUTE command ensures that the new variable will be created in this dataset.

Closing SPSS Datasets

*Close datasets. Alternatively, use "dataset close all." instead of the two lines below.

dataset close idols_data.
dataset close service_data.

*Get rid of the last open dataset.

new file.

Previous tutorial: Convert Characters to Codepoints and Reversely

Next tutorial: Two Digit Year in String – Cautionary Note

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.

This tutorial has 1 comment!