Table and Axis Syntax

This topic provides a detailed description of the syntax you use to specify tables in a script.

Table Specification

A table specification consists of up to two axis specifications that define the side and top of the table in order as follows:

<table-spec> ::=  [<axis-spec>] [* <axis-spec>] 

These axis specifications (sometimes called the root-level axes) define the dimensions of the table. The axis specification on the left of the * defines the side axis, which in turn defines the rows of the table. The axis specification on the right of the * defines the top axis, which in turn defines the columns of the table. IBM® SPSS® Data Collection Survey Reporter supports two table dimensions (side and top).

Axis Specification

<axis-spec>  ::=   <axis>

<axis>       ::=   <axis> > <axis> 
                 | <axis> + <axis> 
                 | (<axis>) 
                 | id as AxisName
                 | id ['label-text'] [as AxisName]
                 | id [LanguageID:'label-text'] [as AxisName]
                 | id {<element-list>}  [MaxResponses = Value] [as AxisName]
                 | axis (id)
                 | axis ( {<element-list>} [MaxResponses = Value]) 
                 | axis ( {<element-list>} [MaxResponses = Value]) as AxisName
PartDescription
> Indicates that the axis on the right of the > symbol is to be nested within the axis on the left of the symbol. Generally the evaluation of the axis specification takes place from left to right. However, when an axis specification contains both > and + symbols, the > symbol takes precedence over the +. (This means that the > symbol is evaluated before the + symbol.) However, you can use parentheses to change the order of precedence.
+ Indicates that the two axes separated by the symbol are to be concatenated.
( ) Parentheses used to indicate that the symbols within the parentheses are to be evaluated before the symbols outside the parentheses.
id Indicates that the axis is to be created from the variable with name id. If an axis expression has been defined in the metadata (in the AxisExpression property), it is used to define the elements. What happens if an axis expression has not been defined in the metadata depends on the variable type. For a categorical variable, all of the elements within the variable are used. For numeric, text, date, and Boolean variables, you will get an error.
id {<element-list>} Indicates that the axis is to be created from the variable with name id and the elements are to be as specified in the element list. You can define new analysis elements in the element list. See the topic Element List Syntax for more information.
axis ( id ) Indicates that the axis is to be created from a reusable axis with name id. A reusable axis is an axis that has been added to the Document.Axes collection.
id as AxisName Indicates that the axis is to be created from the variable with name id, but that the axis will have the name AxisName. Use this if you want to add the same variable to an axis more than once.
axis ( {<element-list>} )Indicates that the axis is to be created without reference to an existing variable. The base for the new variable contains all cases. If you do not specify an axis name, the axis is given the default name of _Custom. If you want to create more than one axis, you should give each one a unique name.
axis ( {<element-list>} ) as AxisNameCreates an axis without reference to an existing variable, and saves it with a unique name.
[MaxResponses = Value]Custom property for axis. When using axis expressions to edit a variable, the max response value could be changed. For example, an axis expression can change a single response variable to a multiple response by doing a net and keep operation. It is important to identify when a variable, or an axis, is single or multiple while performing statistic tests, as they may require different formulas. You should set the appropriate value when the response type is different from the variable.

Note: Do not take statistics elements into account.

Examples

The following table provides some example table specifications.

Table specification:Creates a table that has:
age a side axis only, based on a single variable called age.
* agea top axis only, based on a single variable called age
age * gender a side axis based on the age variable and a top axis based on the gender variable.
interest * axis(MyBanner) a side axis based on a single variable called interest and a top axis based on the reusable axis called MyBanner.
age + gender * interest > before a side axis based on the variables called age and gender concatenated together and a top axis that is based on the variable called before nested inside the variable called interest.
interest * resident + axis(MyBanner) a side axis based on a single variable called interest and a top axis based on a variable called resident concatenated with a reusable axis called MyBanner.
interest{Dinosaurs, Fossils, Whales} * gender a side axis based on three specific elements of a variable called interest and a top axis based on a variable called gender. See the topic Element List Syntax for more information.
age 'Age Range' + gendera side axis only, based on a variable called age with the label Age Range concatenated with a variable called gender with the default label.
age ENU: 'Age Range' ESN: 'Edad' a side axis only, based on a variable called age with labels in United States English (ENU) and International Spanish (ESN). For languages where no label is specified, the default label from the metadata is used.

For details of recognized language codes, see Languages (3-Character Codes).
education as education1 > gender + education as education2 > biologya side axis only, based on a variable called education which is used twice in the axis, once with gender and once with biology nested within it.
axis({base(), male expression('gender={Male}')})a side axis only, with the default name _Custom. The axis is not based on an existing variable.
axis({base(), male expression('gender={Male}')}) as MyMaleAxisa side axis only, with the name MyMaleAxis. The axis is not based on an existing variable.
order{first, second} * order[..].columndemonstrates editing grid and loop iterations.