Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2023-01-13 23:32:12
Size: 1244
Comment:
Revision 5 as of 2023-06-11 20:54:20
Size: 1469
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

The '''`AGGREGATE`''' command computes descriptive statistics.
Line 16: Line 18:
The new variable `Total_Sales` is implicitly created using the `Sales` variable and the `sum` function.

See [[SPSS/AggregateFunctions|here]] for the list of available `AGGREGATE` functions.
See [[SPSS/Aggregate/Functions|here]] for the list of available `AGGREGATE` functions.
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 26: Line 26:
Note that omitting a `/BREAK` subcommand is unsupported in PSPP, and unsupported in SPSS version 16 or earlier. Note that omitting a `/BREAK` subcommand is unsupported in SPSS version 16 or earlier.
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:
----



== Data Model ==

The `AGGREGATE` command causes all pending transformations to execute, and reads the active dataset.

----



== 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.


Data Model

The AGGREGATE command causes all pending transformations to execute, and reads the active dataset.


See also

PSPP manual for AGGREGATE


CategoryRicottone

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