Declares one or more table data structures.
||Factors classifying the tables; default
||Whether to add margins (
||Values for all the tables; default
||Whether to modify (instead of redefining) existing structures (
||Information to be used by default to identify the tables in output (
||Identifiers of the tables|
||Values for each table|
||Number of decimal places for printing|
||Extra text associated with each identifier|
||Identifier for scalar to hold summary of unclassified data associated with each table|
||Minimum value for the contents of each structure|
||Maximum value for the contents of each structure|
||Default format to use when the contents represent dates and times|
||Records the identifier of the variate whose summaries are in the table|
||Records the type of summary that the table contains (
||Records the percentage points for which quantiles have been formed; default
||Records the factors defining the margin over which the table has been converted to percentages|
Tables are used to store numerical summaries of data that are classified into groups. With Genstat, the classification into groups is specified by a set of factors. The table contains an element, called a cell, for each combination of the levels of the factors that classify it.
Tables are declared using the
TABLE directive. The
CLASSIFICATION option specifies the factors classifying the table.
Values can be assigned to the tables by either the
VALUES option or the
VALUES parameter. The option defines a common value for all the tables in the declaration, while the parameter allows them each to be given a different value. If both the option and the parameter are specified, the parameter takes precedence.
MODIFY option is set to
yes any existing attributes and values of the tables are retained (if still appropriate); otherwise these are lost.
DECIMALS parameter allows you to define a number of decimal places to be used by default when each table is printed. You can associate a text of extra annotation with each table using the
EXTRA parameter. The
MAXIMUM parameters allow you to define lower and upper limits on the values in each table. Genstat then prints warnings if values outside that range are allocated to the table. The
DREPRESENTATION parameter allows a scalar or a single-valued text to be specified for each table to indicate that the table stores dates and times, and to define a format to be used for these, by default, when they are printed; details are given in the description of the
A table can also have margins. There is then a margin for each classifying factor; this contains some sort of summary over the levels of that factor. For example, if you have a table in which the cells contain totals of the observations, you would want the marginal cells to contain totals across the levels of the factor. You can define a table to have margins when you declare it, by setting the
MARGINS option of the
TABLE directive to
yes. Alternatively you can add margins later by the
Tables also have an associated scalar which collects a summary of all the observations for which any of the classifying factors has a missing value; these observations cannot be assigned to any cell of the table itself. This scalar is known as the unknown cell of the table. It can be given an identifier, so that you can refer to it, using the
UNKNOWN parameter of the
IPRINT option can be set to specify how the tables will be identified in output:
||uses the identifier;|
||uses the “associated identifier”, if available; this is the identifier of the data variate from which the summaries in the table have been formed.|
IPRINT is not set, the tables will be identified in whatever way is usual for the section of output concerned.
The attribute of the table that records its data variate is set automatically when a table of summaries is formed by the
TABULATE directive. If you have formed the summaries in some other way, you can use the
DATAVARIATE parameter to record the relevant variate yourself. The
SUMMARYTYPE parameter can set an attribute recording the type of summary that the table contains, and the
PERCENTQUANTILE parameter can set an attribute recording the corresponding percentage if the table contains quantiles. (These are alse set automatically for tables formed by
%MARGIN parameter can be set to a pointer of factors defining the margin of the table over which it has been converted to percentages. The pointer may contain just a scalar if the percentages have been formed over the “grand” margin (e.g. the grand total or grand mean). See the
PERCENT procedure (which will set this attribute automatically) for further details. If any of these parameters is not set, the default is to leave the corresponding attribute of the table unchanged. To clear the existing value of one of these attributes, you can put a missing value into the corresponding parameter setting. For example
TABLE Tab; DATAVARIATE=*; SUMMARYTYPE=*; PERCENTQUANTILE=*;\
clears all these attributes for the table
Commands for: Data structures.
" Example TABL-1: declaring a table" FACTOR [LABELS=!T(boy,girl)] Sex FACTOR [LEVELS=5] Class TABLE [CLASSIFICATION=Class,Sex; VALUES=15,17,29,31,34,30,33,35,28,27]\ Classnum PRINT Classnum; DECIMALS=0 " Now a three-way table" FACTOR [LEVELS=2] School TABLE [CLASSIFICATION=School,Class,Sex;\ VALUES=15,17,29,31,34,30,33,35,28,27,18,16,33,31,35,36,34,33,31,32]\ Schoolnm PRINT Schoolnm; DECIMALS=0 " Add margins to both tables" MARGIN Classnum,Schoolnm PRINT Classnum; DECIMALS=0 PRINT Schoolnm; DECIMALS=0