The base in grid tables
Sample script file: GridTables.mrs
This example script is based on the Household sample data set. See
Running the sample table scripts for information on running the example scripts.
Grid tables, unlike a standard table, have either a base row or column, but not both. The base is shown when the rows or columns are created from the variable inside the grid and not when they are formed from the iterations. The base is calculated in both the rows and columns, but by default it is not displayed for the iterations. However, you can show this base if you want to.
The following table is populated at the default level (the level above the grid, in this case, vehicle) that shows the base on both sides of the table:
When this grid table is populated at the vehicle level, each cell shows the number of vehicles for which the given category was chosen in that iteration. In other words, in this table each case is a vehicle. The base therefore shows the total number of vehicles.
Now look at the same table populated at the grid level, which in this example is vehicle.rating (the annotation displays the level as “Features”, as this is the label for the rating grid):
When the grid table is populated at the level of the grid, each cell shows the number of responses for the given category in that iteration. This means that in this table each response to the rating question in each iteration is a case. The base therefore shows the total number of responses in all of the iterations. However, because each iteration was asked once for each vehicle, the number of cases in all the other cells is the same as in the table that is populated at the vehicle level.
To show the base on the side of table that represents the iterations, set the Element.IsHidden property on the Base element to False. For example:
MyTable.Side.SubAxes[0].Elements.Base.IsHidden = False
Setting up bases for grid iterations
The following example demonstrates how to setup bases for grid iterations to include all respondents. The base expressions includes a higher-level question that forces the base to include null values:
double[0..100] precision(5) scale(1) axis("{base1 'Base' base() [IsHidden=True], b 'Base' base('^.Respondent_Number is not null')
[IsHidden=True], s 'Sum [Hidden]' sum(Grid_AE[{..}].AE) [IsHidden=True], m 'Mean' derived('@1 / @2') [Decimals=1]}");
By default, null iterations are omitted because they can hinder performance. The EvaluateEmptyIterations custom property must be applied to the grid in the metadata in order to override the default behavior. For example:
Grid_AE "Attitudinal equity score"
[
EvaluateEmptyIterations = true
]
loop
When EvaluateEmptyIterations custom property is set to true, all iterations, including empty iterations that do not exist in the CDSC, are returned.
See also