= SPSS Crosstabs = The '''`CROSSTABS`''' command creates a cross-tabulation. <> ---- == Usage == {{{ crosstabs /tables=foo by bar. }}} To create a series of tables with `foo` as the row-wise variable in each, try: {{{ crosstabs /tables=foo by ham spam eggs. }}} To create an N-dimensional table, try: {{{ crosstabs /tables=foo by bar by baz. }}} Multiple `/TABLES` subcommands are allowed. {{{ crosstabs /tables=foo by bar /tables=foo by baz. }}} === Format === The default '''`/FORMAT`''' subcommand is `/FORMAT=TABLES AVALUE`. This causes SPSS to create tables (the alternative being `NOTABLES`) and sort values in ascending order (the alternative being `DVALUE`). === Cells === The default '''`/CELLS`''' subcommand is `/CELLS=COUNT`. This causes table cells to be populated with counts of observations. Options are: ||'''Name''' ||'''Effect''' || ||`COUNT` ||count || ||`ROW` ||row percent || ||`COLUMN` ||column percent || ||`TOTAL` ||table percent || ||`EXPECTED` ||expected value || ||`RESIDUAL` ||residual || ||`SRESIDUAL` ||standardized residual || ||`ASRESIDUAL`||adjusted standardized residual|| ||`ALL` ||all of the above || ||`NONE` ||display nothing || If the `/CELLS` subcommand is specified without any options, the `COUNT`, `ROW`, `COLUMN`, and `TOTAL` options are selected automatically. === Count === By default, SPSS uses raw case weights without rounding for counting. Add the '''`/COUNT=ASIS`''' subcommand to explicitly allow this behavior. To use rounding, first pick between '''`CASE`''' for rounding each case's weight before tabulating, and '''`CELL`''' for rounding the final tabulation. Then pick betwen '''`ROUND`''' for rounding to the nearest integer, and '''`TRUNCATE`''' for rounding towards 0. Add a subcommand with the specifications like `/COUNT=CELL ROUND`. If either `CASE` or `CELL` are specified without `ROUND` or `TRUNCATE`, `ROUND` is selected automatically. === Statistics === The '''`/STATISTICS`''' subcommand causes statistics to be computed for the tabulated variables. ||'''Name'''||'''Effect''' || ||`CHISQ` ||Pearson chi-square, likelihood ratio, Fisher's exact test, continuity correction, linear-by-linear association|| ||`PHI` ||phi || ||`CC` ||contingency coefficient || ||`LAMBDA` ||lambda || ||`UC` ||uncertainty coefficient || ||`BTAU` ||tau-b || ||`CTAU` ||tau-c || ||`RISK` ||risk estimate || ||`GAMMA` ||gamma || ||`D` ||Somers' d || ||`KAPPA` ||Cohen’s kappa || ||`ETA` ||eta || ||`CORR` ||Spearman correlation, Pearson’s r || ||`ALL` ||all of the above || ||`NONE` ||no statistics || Even if selected, a statistic is only calculated when appropriate. If the `/STATISTICS` subcommand is specified without any options, the `CHISQ` option is selected automatically. === Missing === By default, SPSS will exclude observations with a user missing value for a tabulated variable. Add the '''`/MISSING=TABLE`''' subcommand to explicitly allow this behavior, or add '''`/MISSING=INCLUDE`''' subcommand to disable it. ---- == Data Model == The `CROSSTABS` command causes all pending transformations to execute, and reads the active dataset. ---- == See also == [[https://www.gnu.org/software/pspp/manual/html_node/CROSSTABS.html|PSPP manual for CROSSTABS]] ---- CategoryRicottone