Desktop User Guides > Professional > Table scripting > Table specification syntax > Table and axis syntax
Table and axis syntax
The conventions used for defining the syntax in this topic are similar to those used in the Advanced Expressions section. See Syntax conventions.
Example: Creating a new axis
You can create an axis specification without basing it on an existing variable, using the syntax axis{(<element-list>)} as MyAxis. For example, if you want to create a variable containing only the Male category of the gender variable, instead of modifying the existing variable using the syntax:
Set Table = TableDoc.Tables.AddNew("Table1", "gender{base(), male expression('gender={Male}')} * age")
you can create a new variable directly, using the syntax:
Set Table = TableDoc.Tables.AddNew("Table2", "axis({base(), male expression('gender={Male}')}) * age")
This avoids the need to create a new derived variable using MDM script. It also makes it easier to create several variables based on the same initial variable. For example, you could also create a variable containing the Female category and add both variables to the table, using the syntax:
Set Table = TableDoc.Tables.AddNew("Table3", "axis({base(), male expression('gender={Male}')}) as MyMaleAxis + axis({base(),
female expression('gender={Female}')}) as MyFemaleAxis * age")
The variable is always created at the top (HDATA) level.
For an example script that uses the axis({}) syntax, see Creating summary statistic tables.
See also
Table specification syntax