Documentation: Add an example showing how AGGREGATE works
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2020 10:29:43 +0000 (11:29 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2020 10:29:43 +0000 (11:29 +0100)
doc/automake.mk
doc/pspp-figures/aggregate.sps [new file with mode: 0644]
doc/transformation.texi

index 9800d5849db3bc1397d39ae9388f4c5c90ccf22f..7cbb819db364361a9bd5fa954093760e706deeed 100644 (file)
@@ -111,7 +111,8 @@ am__TEXINFO_TEX_DIR=:$(top_srcdir)/doc:$(top_builddir)/doc
 ################# Example programs ##############################
 
 FIGURE_SYNTAX = \
- doc/pspp-figures/autorecode.sps \
+ doc/pspp-figures/aggregate.sps \
+doc/pspp-figures/autorecode.sps \
  doc/pspp-figures/chisquare.sps \
  doc/pspp-figures/compute.sps \
  doc/pspp-figures/count.sps \
diff --git a/doc/pspp-figures/aggregate.sps b/doc/pspp-figures/aggregate.sps
new file mode 100644 (file)
index 0000000..b84620b
--- /dev/null
@@ -0,0 +1,10 @@
+get file="personnel.sav".
+
+aggregate outfile=* 
+        mode = replace
+        /break= occupation
+        /occ_mean_salaray = mean (salary)
+        /occ_median_salary = median (salary)
+        /occ_std_dev_salary = sd (salary).
+
+list.
index b6c8e960c70a1408d4398f7c9b619b988e58c902..5161df224ebcb5c63fcb684e347b6791d7765b95 100644 (file)
@@ -224,6 +224,34 @@ causes the period to be interpreted as the end of the command.)
 @cmd{AGGREGATE} both ignores and cancels the current @cmd{SPLIT FILE}
 settings (@pxref{SPLIT FILE}).
 
+@subsection Aggregate Example
+
+The @file{personnel.sav} dataset provides the occupations and salaries of
+many individuals.  For many purposes however such detailed information is
+not interesting, but often the aggregated statistics of each occupation are
+of interest.  In @ref{aggregate:ex} the @cmd{AGGREGATE} command is used
+to calculate the mean, the median and the standard deviation of each
+occupation.
+
+@float Example, aggregate:ex
+@psppsyntax {aggregate.sps}
+@caption {Calculating aggregated statistics from the @file{personnel.sav} file.}
+@end float
+
+Since we chose the @samp{MODE = REPLACE} option, in @ref{aggregate:res} cases
+for the individual persons are no longer present.  They have each been replaced
+by a single case per aggregated value.
+
+@float Results, aggregate:res
+@psppoutput {aggregate}
+@caption {Aggregated mean, median and standard deviation per @exvar{occupation}.}
+@end float
+
+Note that some values for the standard deviation are blank.
+This is because there is only one case with the respective
+occupation.
+
+
 @node AUTORECODE
 @section AUTORECODE
 @vindex AUTORECODE