Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Statscraft 0.61.0, release v0.61.0

SORT CASES

Sort the cases by the values of variables.

Syntax

SORT CASES [BY] varlist [(A | D)] [varlist [(A | D)] ...].

A is ascending (the default), D descending; a direction covers the variables before it.

System-missing sorts lowest. Cases with equal keys keep their order.

Example

GET FILE='survey.sav'.
SORT CASES BY spend (D).
LIST id region spend /CASES=FROM 1 TO 5.
SORT CASES BY region age_group (A) age (D).

The example reads the sample data file survey.sav, an invented customer survey; save it in the folder you run the syntax from.

Example output

List

idregionspend
1294.52
113290.56
80385.18
49379.74
61272.36

statscraft help SORT CASES prints the same text in the terminal. All commands