+@subsection Crosstabs Example
+
+@cindex chi-square test of independence
+
+A researcher wishes to know if, in an industry, a person's sex is related to
+the person's occupation. To investigate this, she has determined that the
+@file{personnel.sav} is a representative, randomly selected sample of persons.
+The researcher's null hypothesis is that a person's sex has no relation to a
+person's occupation. She uses a chi-squared test of independence to investigate
+the hypothesis.
+
+@float Example, crosstabs:ex
+@psppsyntax {crosstabs.sps}
+@caption {Running crosstabs on the @exvar{sex} and @exvar{occupation} variables}
+@end float
+
+The syntax in @ref{crosstabs:ex} conducts a chi-squared test of independence.
+The line @code{/tables = occupation by sex} indicates that @exvar{occupation}
+and @exvar{sex} are the variables to be tabulated. To do this using the @gui{}
+you must place these variable names respectively in the @samp{Row} and
+@samp{Column} fields as shown in @ref{crosstabs:scr}.
+
+@float Screenshot, crosstabs:scr
+@psppimage {crosstabs}
+@caption {The Crosstabs dialog box with the @exvar{sex} and @exvar{occupation} variables selected}
+@end float
+
+Similarly, the @samp{Cells} button shows a dialog box to select the @code{count}
+and @code{expected} options. All other cell options can be deselected for this
+test.
+
+You would use the @samp{Format} and @samp{Statistics} buttons to select options
+for the @subcmd{FORMAT} and @subcmd{STATISTICS} subcommands. In this example,
+the @samp{Statistics} requires only the @samp{Chisq} option to be checked. All
+other options should be unchecked. No special settings are required from the
+@samp{Format} dialog.
+
+As shown in @ref{crosstabs:res} @cmd{CROSSTABS} generates a contingency table
+containing the observed count and the expected count of each sex and each
+occupation. The expected count is the count which would be observed if the
+null hypothesis were true.
+
+The significance of the Pearson Chi-Square value is very much larger than the
+normally accepted value of 0.05 and so one cannot reject the null hypothesis.
+Thus the researcher must conclude that a person's sex has no relation to the
+person's occupation.
+
+@float Results, crosstabs:res
+@psppoutput {crosstabs}
+@caption {The results of a test of independence between @exvar{sex} and @exvar{occupation}}
+@end float
+
+@node CTABLES
+@section CTABLES
+
+@vindex CTABLES
+@cindex custom tables
+@cindex tables, custom
+
+@code{CTABLES} has the following overall syntax. At least one
+@code{TABLE} subcommand is required:
+
+@display
+@t{CTABLES}
+ @dots{}@i{global subcommands}@dots{}
+ [@t{/TABLE} @i{axis} [@t{BY} @i{axis} [@t{BY} @i{axis}]]
+ @dots{}@i{per-table subcommands}@dots{}]@dots{}
+@end display
+
+@noindent
+where each @i{axis} may be empty or take one of the following forms:
+
+@display
+@i{variable}
+@i{variable} @t{[}@{@t{C} @math{|} @t{S}@}@t{]}
+@i{axis} + @i{axis}
+@i{axis} > @i{axis}
+(@i{axis})
+@i{axis} @t{(}@i{summary} [@i{string}] [@i{format}]@t{)}
+@end display
+
+The following subcommands precede the first @code{TABLE} subcommand
+and apply to all of the output tables. All of these subcommands are
+optional:
+
+@display
+@t{/FORMAT}
+ [@t{MINCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
+ [@t{MAXCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
+ [@t{UNITS=}@{@t{POINTS} @math{|} @t{INCHES} @math{|} @t{CM}@}]
+ [@t{EMPTY=}@{@t{ZERO} @math{|} @t{BLANK} @math{|} @i{string}@}]
+ [@t{MISSING=}@i{string}]
+@t{/VLABELS}
+ @t{VARIABLES=}@i{variables}
+ @t{DISPLAY}=@{@t{DEFAULT} @math{|} @t{NAME} @math{|} @t{LABEL} @math{|} @t{BOTH} @math{|} @t{NONE}@}
+@t{/MRSETS COUNTDUPLICATES=}@{@t{YES} @math{|} @t{NO}@}
+@t{/SMISSING} @{@t{VARIABLE} @math{|} @t{LISTWISE}@}
+@t{/PCOMPUTE} @t{&}@i{category}@t{=EXPR(}@i{expression}@t{)}
+@t{/PPROPERTIES} @t{&}@i{category}@dots{}
+ [@t{LABEL=}@i{string}]
+ [@t{FORMAT=}[@i{summary} @i{format}]@dots{}]
+ [@t{HIDESOURCECATS=}@{@t{NO} @math{|} @t{YES}@}
+@t{/WEIGHT VARIABLE=}@i{variable}
+@t{/HIDESMALLCOUNTS COUNT=@i{count}}
+@end display
+
+The following subcommands follow @code{TABLE} and apply only to the
+previous @code{TABLE}. All of these subcommands are optional:
+
+@display
+@t{/SLABELS}
+ [@t{POSITION=}@{@t{COLUMN} @math{|} @t{ROW} @math{|} @t{LAYER}@}]
+ [@t{VISIBLE=}@{@t{YES} @math{|} @t{NO}@}]
+@t{/CLABELS} @{@t{AUTO} @math{|} @{@t{ROWLABELS}@math{|}@t{COLLABELS}@}@t{=}@{@t{OPPOSITE}@math{|}@t{LAYER}@}@}
+@t{/CRITERIA CILEVEL=}@i{percentage}
+@t{/CATEGORIES} @t{VARIABLES=}@i{variables}
+ @{@t{[}@i{value}@t{,} @i{value}@dots{}@t{]}
+ @math{|} [@t{ORDER=}@{@t{A} @math{|} @t{D}@}]
+ [@t{KEY=}@{@t{VALUE} @math{|} @t{LABEL} @math{|} @i{summary}@t{(}@i{variable}@t{)}@}]
+ [@t{MISSING=}@{@t{EXCLUDE} @math{|} @t{INCLUDE}@}]@}
+ [@t{TOTAL=}@{@t{NO} @math{|} @t{YES}@} [@t{LABEL=}@i{string}] [@t{POSITION=}@{@t{AFTER} @math{|} @t{BEFORE}@}]]
+ [@t{EMPTY=}@{@t{INCLUDE} @math{|} @t{EXCLUDE}@}]
+@t{/TITLES}
+ [@t{TITLE=}@i{string}@dots{}]
+ [@t{CAPTION=}@i{string}@dots{}]
+ [@t{CORNER=}@i{string}@dots{}]
+@t{/SIGTEST TYPE=CHISQUARE}
+ [@t{ALPHA=}@i{siglevel}]
+ [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
+ [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
+@t{/COMPARETEST TYPE=}@{@t{PROP} @math{|} @t{MEAN}@}
+ [@t{ALPHA=}@i{value}[@t{,} @i{value}]]
+ [@t{ADJUST=}@{@t{BONFERRONI} @math{|} @t{BH} @math{|} @t{NONE}@}]
+ [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
+ [@t{MEANSVARIANCE=}@{@t{ALLCATS} @math{|} @t{TESTEDCATS}@}]
+ [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
+ [@t{MERGE=}@{@t{NO} @math{|} @t{YES}@}]
+ [@t{STYLE=}@{@t{APA} @math{|} @t{SIMPLE}@}]
+ [@t{SHOWSIG=}@{@t{NO} @math{|} @t{YES}@}]
+@end display
+
+The @code{CTABLES} (aka ``custom tables'') command outputs
+multi-dimensional tables, offering many options for table
+summarization and formatting.
+
+@code{TABLE}, the only required subcommand, specifies the variables to
+include on each dimension, using the syntax @t{/TABLE} @i{rows} @t{BY}
+@i{columns} @t{BY} @i{layers}, in which @i{rows}, @i{columns}, and
+@i{layers} is each empty or an @i{axis}. The simplest form of
+@i{axis} is just a variable name.
+
+