Table and axis syntax in scripts
Table specification
A table specification consists of one or two axis specifications that define the side and top of the table in order as follows:
<table-spec> ::= [<axis-spec1>] [* <axis-spec2>]
These axis specifications (sometimes called the root-level axes) define the dimensions of the table.
The first axis specification defines the side axis, which in turn defines the rows of the table.
The second axis specification defines the top axis, which in turn defines the columns of the table.
UNICOM Intelligence Reporter - Survey Tabulation supports two table dimensions (side and top).
Axis specification
<axis-spec> ::= <axis>
<axis> ::= <axis> > <axis>
| <axis> + <axis>
| (<axis>)
| <variable> as <axis_name>
| <variable> ['<label_text>'] [as <axis_name>]
| <variable> [LanguageID:'<label_text>'] [as <axis_name>]
| <variable>
{<element_list>} [MaxResponses = <value>] [as <axis_name>]
| axis (<axis>)
| axis ( {<element_list>} [MaxResponses = <value>])
| axis ( {<element_list>} [MaxResponses = Value]) as <axis_name>
Parts
>
Nests the axis on the right of the > symbol within the axis on the left of the symbol.
The axis specification is evaluated from left to right. However, when an axis specification contains both > and + symbols, > is evaluated before the +.
You can use parentheses to change the order of precedence.
+
Concatenates two axes.
( )
Evaluates the symbols within the parentheses before the symbols outside the parentheses.
<variable>
Creates the axis from the variable specified.
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, an error occurs.
<variable> {<element_list>}
Creates the axis from the variable specified, with the elements that are specified in the element list.
You can define new analysis elements in the element list. For more information, see
Element list syntax.
axis (<axis>)
Creates the axis from a reusable axis. A reusable axis is an axis that has been added to the Document.Axes collection.
<variable> as <axis_name>
Creates the axis from the specified variable, and gives it the specified name. Use this if you want to add the same variable to an axis more than once.
axis ({<element_list>})
Creates the axis without reference to an existing variable. The base for the new variable contains all cases.
The default name is _Custom. If you want to create more than one axis, give each one a unique name.
axis (<element_list>) as <axis_name>
Creates 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 whether a variable, or an axis, is single or multiple while performing statistic tests, as they might require different formulas. Set the appropriate value when the response type is different from the variable. Do not take statistics elements into account.
Examples
age
Creates a table that has a side axis only, based on a single variable called age.
* age
Creates a table that has a top axis only, based on a single variable called age
age *
Creates a table that has gender a side axis based on the age variable and a top axis based on the gender variable.
interest * axis(MyBanner)
Creates a table that has 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
Creates a table that has 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)
Creates a table that has 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
Creates a table that has a side axis based on three specific elements of a variable called
interest and a top axis based on a variable called
gender. For more information, see
Element list syntax.
age ’Age Range’ + gender
Creates a table that has a 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’
Creates a table that has 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.
education as education1 > gender + education as education2 > biology
Creates a table that has a 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}’)})
Creates a table that has 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 MyMaleAxis
Creates a table that has a side axis only, with the name MyMaleAxis. The axis is not based on an existing variable.
order{first, second} * order[..].column
Creates a table that demonstrates editing grid and loop iterations.
See also