IBM Support

Creating a consecutive ID number

Troubleshooting


Problem

How can I assign a series of consecutive ID numbers to my cases?

Resolving The Problem

The $casenum variable is a system variable in SPSS that numbers the cases in your data set. You may use the following command:

COMPUTE id=$casenum.
EXECUTE.

This creates a variable called ID that numbers the cases consecutively from 1 to N, N being the number of cases in your active data set.

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"19.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

21687

Document Information

Modified date:
16 April 2020

UID

swg21476977