Differences between revisions 2 and 3
Revision 2 as of 2023-06-09 16:55:08
Size: 1179
Comment:
Revision 3 as of 2023-06-09 17:10:46
Size: 1333
Comment:
Deletions are marked like this. Additions are marked like this.
Line 24: Line 24:
The `/BREAK` subcommand specifies one or more variables to split aggregation. The '''`/BREAK`''' subcommand specifies one or more variables to split aggregation.
Line 32: Line 32:
If the dataset is already sorted by all variables specified on the `/BREAK` subcommand, use the `/PRESORTED` subcommand to skip re-sorting. The `/PRESORTED` subcommand ''must'' precede the `/BREAK` subcommand. If the dataset is already sorted by all variables specified on the `/BREAK` subcommand, use the ''''`/PRESORTED`''' subcommand to skip re-sorting. The `/PRESORTED` subcommand ''must'' precede the `/BREAK` subcommand.
Line 38: Line 38:
The default behavior is `OUTFILE=*` and `MODE=ADDVARIABLES` (i.e. modify the active dataset in-place and add variables to it). The default behavior is '''`OUTFILE=*`''' and '''`MODE=ADDVARIABLES`''' (i.e. modify the active dataset in-place and add variables to it).
Line 55: Line 55:
----



== See also ==

[[https://www.gnu.org/software/pspp/manual/html_node/AGGREGATE.html|PSPP manual for AGGREGATE]]

SPSS Aggregate

The AGGREGATE command computes descriptive statistics.


Usage

aggregate outfile=* mode=addvariables
  /Total_Sales = sum(Sales).

See here for the list of available AGGREGATE functions.

Break

The /BREAK subcommand specifies one or more variables to split aggregation.

Note that omitting a /BREAK subcommand is unsupported in SPSS version 16 or earlier.

Presorted

If the dataset is already sorted by all variables specified on the /BREAK subcommand, use the '/PRESORTED subcommand to skip re-sorting. The /PRESORTED subcommand must precede the /BREAK subcommand.

Outfile and Mode

The default behavior is OUTFILE=* and MODE=ADDVARIABLES (i.e. modify the active dataset in-place and add variables to it).

To instead populate a new dataset, try:

sort cases by VARLIST.
dataset declare DUPLICATES.
aggregate
  /outfile="DUPLICATES"
  /presorted
  /break=VARLIST
  /COUNT=N.
execute.
dataset activate DUPLICATES.
select if COUNT>1.


See also

PSPP manual for AGGREGATE


CategoryRicottone

SPSS/Aggregate (last edited 2024-01-02 17:11:03 by DominicRicottone)