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.7.0, release v0.7.0

AGGREGATE

Aggregate groups of cases into new variables or a new dataset.

Syntax

AGGREGATE [/OUTFILE=* | 'path' | dataset [MODE=ADDVARIABLES | REPLACE]] [/BREAK=varlist [(A | D)] ...]
          /target ['label'] [target ...] = function(varlist) [/target ...].
OUTFILE=* replaces the active dataset with one case per break group (break variables, then
targets); with MODE=ADDVARIABLES it keeps the cases and adds the targets to each of them.
OUTFILE='path' writes the aggregated dataset to a file and leaves the active dataset alone;
OUTFILE=dataset puts it into a dataset that DATASET DECLARE or DATASET NAME defined.
Without OUTFILE the targets are added to every case, as with OUTFILE=* MODE=ADDVARIABLES.
functions: SUM MEAN SD MEDIAN MIN MAX FIRST LAST N NU NMISS NUMISS; N and NU also without (varlist).
Missing values are skipped. With a weight variable SUM, MEAN, SD, MEDIAN, N and NMISS are weighted.

Example

AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=region /region_mean = MEAN(income) /region_n = N.

statscraft help AGGREGATE prints the same text in the terminal. All commands