27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

94 AGGREGATE<br />

Example<br />

AGGREGATE OUTFILE=AGGEMP<br />

/BREAK=LOCATN DEPT (A) TENURE (D)<br />

/AVGSAL = MEAN(SALARY).<br />

• BREAK names the variables LOCATN, DEPT, and TENURE as the break variables.<br />

• Cases in the aggregated file are sorted in ascending order of LOCATN, in ascending order<br />

of DEPT within LOCATN, and in descending order of TENURE within LOCATN and DEPT.<br />

For each group defined by these variables, AVGSAL is computed as the mean of salary.<br />

DOCUMENT Subcommand<br />

DOCUMENT copies documentation from the original file into the aggregated file. By default,<br />

documents are dropped from the aggregated file, whether the file is the working file or an<br />

SPSS-format data file. DOCUMENT must appear after OUTFILE but before BREAK.<br />

PRESORTED Subcommand<br />

PRESORTED indicates that cases in the working data file are sorted according to the values of<br />

the break variables. Without PRESORTED, AGGREGATE must store the entire result data set<br />

in memory. With PRESORTED, it stores only one result case in memory. Thus, specifying<br />

PRESORTED reduces the memory needed and makes AGGREGATE run faster.<br />

• If specified, PRESORTED must precede BREAK. The only specification is the keyword<br />

PRESORTED. PRESORTED has no additional specifications.<br />

• When PRESORTED is specified, the program forms an aggregate case out of each group<br />

of adjacent cases with the same values for the break variables.<br />

• If the working file is not sorted by the break variables in ascending order and PRESORTED<br />

is specified, a warning message is generated but the procedure is executed. Each group of<br />

adjacent cases with the same values for break variables forms a case in the aggregated file,<br />

which may produce multiple cases with the same values for the break variables.<br />

Example<br />

AGGREGATE OUTFILE=AGGEMP<br />

/PRESORTED<br />

/BREAK=LOCATN DEPT<br />

/AVGSAL = MEAN(SALARY).<br />

• PRESORTED indicates that cases are already sorted by the variables LOCATN and DEPT.<br />

• AGGREGATE does not make an extra data pass to sort the cases.<br />

Aggregate Functions<br />

An aggregated variable is created by applying an aggregate function to a variable in the<br />

working file. The variable in the working file is called the source variable, and the new<br />

aggregated variable is the target variable.<br />

• The aggregate functions must be specified last on AGGREGATE.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!