This article describes how you can use a QScript to combine several Binary - Multi questions into a Binary Grid question, or several Number - Multi questions into a Number - Grid.
In this articles, we will work through an example to produce a table that looks like this:
The key things to keep in mind with grouping together variables into questions are:
- Each variable needs to be stored into a Numeric - Multi or Binary - Multiple variable set.
- Consistent Order – the order in which options appear for each attribute. You can drag and drop variables in the Data Sets tree to line them up correctly.
- Consistent Labels – the labels of the questions must include both the final row and column names (Note: these are also case-sensitive). I’ve found it yields the best results to separate them using spaces and a special character like “–”or “:”. Displayr makes it easy to edit labels by changing them directly in the Data Sets tree or using Find/Replace.
Load the data
If you want to work through the example with the same data used in this article:
- Download the file to your computer. The file we will be using in this example is called Cola_dataset.csv. You can use this link to download the file: CSV file.
- Create a new Displayr document and load the data.
Review the data
You can see the brand attitude question looking at attitudes and colas is broken into several questions and in different formats. For example, the feminine questions are already stored in a grid, but in contrast, the health-conscious questions are broken into multiple variables.
The rest of the questions we want to use (innocent, older, open to new experiences, rebellious, sleepy, and traditional) are stored in another variable called Grid.
The rest of this article will work through the tasks we need to accomplsih to combine these variables into a single grid which we will call Brand Attitudes.
Standardize the labels
In order to combine the questions into the same grid, the variables in each variable set must have identical labels. We will edit the labels for health-conscious, innocent, older, open to new experiences, rebellious, sleepy, and traditional to match the ones for the feminine variables:
We will start with the health-conscious varaibles.
- In the Data Sets tree, right-click and rename each label for the health-conscious rows to look the the feminine rows
- After you have renamed all the labels, make sure that they are in the same order as ones for feminine. If not, drag and drop the rows to make sure the options are in the same order.
- Highlight all health-conscious rows and from the toolbar, Combine > As a Variable Set > Do Not Merge Variables. (you may need to remove the leading "X" from the variable name).
The next step is to deal with the variables contained in the Grid variable.
- In the Data Set tree, right-click on Grid and select Split.
- Rename the labels for the innocent rows to match the ones in the feminine rows.
- Highlight the innocent rows, right click the highlighted area, and select Combine.
The results are as follows:
- Repeat steps 1 and 2 for health-conscious, innocent, older, open to new experiences, rebellious, sleepy, and traditional.
Standardize the structure of each variable set
In order to combine the variable sets into the same grid, they must have one of the following structures: Numeric - Multi or Binary - Multi.
- In the Data Sets tree, select the feminine variable set
- In the Object Inspector, change the structure for feminine to Binary - Multi: Non-mutually exclusive categories.
- Click fix if you get a message that the values to be counted should be verified and then OK.
- Repeat steps 1 thru 3 for health-conscious, innocent, older, open to new experiences, rebellious, sleepy, and traditional.
Create the Final Grid
To combine the variables into a grid:
- Select the variable sets feminine, health-conscious, innocent, older, open to new experiences, rebellious, sleepy, and traditional.
- Select Anything > Data > Variables > New > Ready-Made New Variable(s) > Combine Variable Sets as a Grid.
- Rename your new grid to Brand Attitudes
You now have a grid variable called Brand Attitudes.