CTABLES
Custom tables: nested, stacked and layered variables with totals, subtotals, computed categories, many summary statistics per cell, multiple response sets and column comparison tests.
Syntax
Section titled “Syntax”CTABLES [/VLABELS VARIABLES=varlist DISPLAY=DEFAULT|NAME|LABEL|BOTH|NONE] [/MRSETS COUNTDUPLICATES=NO|YES] [/SMISSING VARIABLE|LISTWISE] [/FORMAT EMPTY=ZERO|BLANK|'text' MISSING='text'] [/HIDESMALLCOUNTS COUNT=n] [/WEIGHT VARIABLE=var] [/PCOMPUTE &name = EXPR(expression)] [/PPROPERTIES &name LABEL='…' FORMAT=function format HIDESOURCECATS=YES] /TABLE rows [BY columns [BY layers]] [/CATEGORIES VARIABLES=varlist [explicit list] | ORDER=A|D KEY=VALUE|LABEL MISSING=EXCLUDE|INCLUDE EMPTY=INCLUDE|EXCLUDE [TOTAL=YES LABEL='Total' POSITION=AFTER|BEFORE]] [/TITLES TITLE='…' CAPTION='…' CORNER='…'] [/SLABELS POSITION=COLUMN|ROW|LAYER VISIBLE=YES|NO] [/CLABELS ROWLABELS=OPPOSITE|COLLABELS=OPPOSITE] [/COMPARETEST TYPE=PROP|MEAN ALPHA=.05 ADJUST=BONFERRONI|BH|NONE STYLE=APA|SIMPLE INCLUDEMRSETS=NO|YES MEANSVARIANCE=ALLCATS|TESTEDCATS] [/SIGTEST TYPE=CHISQUARE ALPHA=.05] [/TABLE … (each /TABLE takes its own /CATEGORIES … /SIGTEST)].Synopsis
Section titled “Synopsis”| Kind | Procedure (reads data, produces output) |
| Body | main /SUBCOMMAND[=] … |
| Changes data | no |
| Subcommands | /CATEGORIES, /CLABELS, /COMPARETEST, /FORMAT, /HIDESMALLCOUNTS, /MRSETS, /PCOMPUTE, /PPROPERTIES, /SIGTEST, /SLABELS, /SMISSING, /TABLE, /TITLES, /VLABELS, /WEIGHT |
| Menu | Analyze ▸ Tables |
| Slot: Rows | 0+ variable(s); levels: nominal, ordinal, scale; types: numeric, string |
| Slot: Columns | 0+ variable(s); levels: nominal, ordinal, scale; types: numeric, string |
| Slot: Layers | 0+ variable(s); levels: nominal, ordinal, scale; types: numeric, string |
Specifications
Section titled “Specifications”- TABLE: a > b nests b within a; a + b stacks; [C] / [S] set the measurement level; [COUNT, COLPCT.COUNT PCT5.1 ‘Col %’, MEAN F8.2] lists summaries
- CATEGORIES: explicit lists take values, lo THRU hi, OTHERNM, MISSING, SUBTOTAL=‘label’, HSUBTOTAL, &computed
- PCOMPUTE: computed category: arithmetic on [value], [lo THRU hi], [SUBTOTAL=n], [TOTAL] applied to each statistic
- COMPARETEST: column proportions (z) or means (t) tests within each row of a subtable; APA subscripts or a separate letters table
- SIGTEST: Pearson chi-square test of each subtable
Examples
Section titled “Examples”CTABLES /TABLE region [COUNT, COLPCT] BY gender /CATEGORIES VARIABLES=region TOTAL=YES.CTABLES /TABLE agegroup > income [MEAN, MEDIAN] BY gender /COMPARETEST TYPE=MEAN.CTABLES /PCOMPUTE &top2 = EXPR([4] + [5]) /PPROPERTIES &top2 LABEL='Top 2 box' /TABLE satisfaction [COLPCT] BY region /CATEGORIES VARIABLES=satisfaction [1, 2, 3, 4, 5, &top2].CTABLES /TABLE $brands [COUNT, COLPCT, RESPONSES] BY gender BY year.- Summary functions: COUNT, VALIDN, TOTALN, RESPONSES, MEAN, MEDIAN, MODE, STDDEV, VARIANCE, SEMEAN, SUM, MINIMUM, MAXIMUM, RANGE, PTILE n, and ROWPCT, COLPCT, TABLEPCT, SUBTABLEPCT, LAYERPCT, LAYERROWPCT, LAYERCOLPCT with .COUNT, .VALIDN, .TOTALN, .SUM or .RESPONSES bases. A U prefix (UCOUNT, UCOLPCT) ignores weights.
- Percentage bases and test formulas are in docs/algorithms/custom-tables.md. Default summaries are COUNT for categorical cells and MEAN for scale variables.
- The Table Builder (Analyze ▸ Tables ▸ Custom Tables) writes this syntax.
- Categories can be ordered by a statistic: KEY=COUNT, VALIDN, TOTALN or FUNCTION(var) such as KEY=MEAN(income).
- TOTALS[…] in /TABLE gives the summaries shown in total and subtotal cells.
- /COMPARETEST corrects column proportions and means for multiple response sets whose columns overlap; /SIGTEST INCLUDEMRSETS=YES tests multiple response sets (Bilder–Loughin, Bonferroni).
Related
Section titled “Related”MRSETS, MULT RESPONSE, CROSSTABS, MEANS
Generated from OrcStat’s command registry and reference. To suggest a change, open an issue.