This document will help users understand how to use and what they need to input into the Add Rows/Columns Feature in the Cross Table – Edit tool.
The Add Row/Column feature is designed so that users can add a new row or column to single-punch or multi-punch variable types* that already exist without having to create a new variable.
To do this, users need to input a logical expression to add the row or column they require.
*NB: this feature does not allow users to add columns/rows to grid, open-end, or numeric variable types.
Access the Row/Column tool:
To access the Add Rows/Columns Feature in the Cross Table – Edit tool go to:
Analysis & Reporting > Cross Table > Edit:
Once in the Edit function, click on the Actions menu and then “Add Row” this menu will also allow you to edit or delete an added row/column once it has been created:
Once you click “add row” a modal will open where you need to enter the row/column’s title and the logical expression that defines it. For example, say I want to add UK Men and UK women to the country variable in this dataset so that they are included in my banner. I would need to give the new columns a title and then enter the expression that defines these groups:
Once I click “Add” the Edit window will close and a new column will be added to my column variable:
To edit or delete these, select the variable you want to edit then click Edit > select the code(s) you want to edit/delete > click Actions > then edit or delete your custom code as required> click update when you are finished.
NB: Adding a custom row hard codes this to the variable. If you add the variable again, the custom row you created will always appear. If you need to include a custom row on one row or banner variable, but don't want it to appear in other places, you can switch your custom rows off as required via the Edit function.
Working with logical expressions to add the row or column
In order to add a new code to a row or column variable, users need to be able to define this code using logical expressions. In short, this tells Analysis & Reporting what to add to the relevant variable to create a new row or column.
Sticking with the example above, we added “UK Men” as column/banner in the country variable. To do this, we had to enter the country variable’s ID (dCountry), the code that defines a respondent as from the UK (1), we also had to enter the gender variable’s ID (D1), and the code that defines a respondent as a man (1). To do this, the full expression is: \dCountry.a=1&\D1.a=1
Breaking down the logic:
Analysis & Reporting works with logical expressions. The primary components of the basic expressions is:
“\” followed by a variable ID
“.a=” followed by the relevant answer code(s)
“&” denotes “AND” ahead of variable IDs
“|” denotes “OR” ahead of variable IDs
“;” denotes "AND” between answer choices in the same variable
Example 1: UK Men
In the UK Men expression: \dCountry.a=1&\D1.a=1
Here we are telling the system that we want respondents who are from the UK and are men included in our definition.
The “\” flags each variable ID
The “.a=” flags the relevant answer code from each variable
The “&” flags that there will be another variable that needs to be included as part of the definition.
Example 2: UK or USA
In the UK or USA expression: \dCountry.a=1;2
Here we are telling the system that we want respondents from the UK or USA included in our definition.
The “\” flags the variable ID
The “.a=” flags the relevant answer codes
The “;” flags that respondents can be from the UK (code 1) or the USA (code 2)
Example 3: London or Tri-State Area
In the London or Tri-State Area expression: \D3UK.a=3|\D3US.a=7;30;32
Here we are telling the system that we want respondents from Lonon OR from any of Connecticut or New Jersey or New York
The “\” flags a variable ID
The “.a=” flags the relevant answer codes “3” for London “7 or 30 or 32” for Connecticut or New Jersey or New York
The “|” flags that respondents can be from the specified UK region code OR from the specified US states codes
The “;” flags that respondents from the USA can be from any of the following states: Connecticut (code 7) or New Jersey (code 30) or New York (code 32)