This worksheet describes how to set up a Smart Report so it dynamically selects the data depending on the context. The context is a variable containing a list of possible values.
The Smart Report will automatically produce a report for each context value. This worksheet uses the sample Crocodile survey supplied with Snap. The survey evaluates a restaurant chain with four branches (two in the UK and two in the USA). The worksheet describes how to use the location as the context, allowing you to produce separate reports for each location.
The report will consist of a title and a bar chart comparing the current location and all locations (including the current) and other locations (all locations excluding the current location). The chart will use the name of the current location in the chart labels, so the report for Bristol, UK will have a chart comparing Bristol to all locations, and the report for Boston, US will have a chart comparing Boston to all locations.
The worksheet assumes:
- you are familiar with Snap
- you have created reports before
- you have a copy of the sample Crocodile survey which is distributed with Snap 11
- you have a pdf printer driver available
- you understand reports with dynamic data (as covered in the worksheet: Creating a Smart Report which includes automatic text)
When you are creating a Smart Report, you usually want to put the most up-to-date data in the report. This data changes as more responses come in, so you must have a way of representing it that allows it to change when the data changes. You can look at all the survey data or focus on a subset that you are interested in. There are two ways of doing this:
Using a filter
This allows you to select the cases that you are interested in. For example, you might filter your data so you are only looking at the data provided by respondents over 50.
This method is easy to set up, but means that you cannot see data that has been filtered out. For example, you would only be able to analyse the blue mouse data once a blue mouse filter has been applied.
Using a context
This allows you to look at a subset of data in a group of cases which have been tagged with a value in a context variable. You can also access data without that tag value, so you can compare the tagged subset with all data.
For example, if your context variable was “mouse colour”, you could set the context to “blue”.
You would be able to analyse the data for mice tagged as blue, but you could also compare the blue mice to the other mice.
The owner of the blue mice could get a personalised report that showed how their mice compared to the average mouse.
By setting the context to red, you can generate a report for the owner of the red mice with the appropriate data for their mice.
The context does not just work on data. You can associate images, chart labels or report text with the different contexts, so the report look and content will change when you change the context from blue to red.
- Create variables for the list of items that you wish to produce individual reports for. These are your context variables. Give them meaningful names. This worksheet uses Q0 (location) as the context variable and changes its name to make it easier to understand.
- Create any derived variables needed to analyse your context data relative to other data or a benchmark.
- Create your reports, referencing the context for each item that you want to personalise.
- Set the context manually to create your reports.
Change the name of the location variable
It makes life much simpler if your variables have meaningful names.
- Open the Crocodile survey supplied with Snap.
- Click on the Snap toolbar to display the Variables window.
- Find Q0 in the window.
- Double-click it to open the variable details.
- Change the Name from Q0 to Location. (You can safely do this as the name does not appear in the questionnaire.)
- Click to save the changes.
Setting up the derived variable for analysis
This step shows how to set up a derived variable which compares data from the current location (the context) to all data. The variable will derive its labels as well as its data from the context variable.
- Click on the Variables window toolbar to add a new variable.
- Specify the Variable details:Name: CComparison
Label: Compare context to all
Type: Derived (the variable will derive its data from Location, the existing location question).
Response: Multiple (each respondent will fall into two cases).
- Double click in the first code label and click the [Insert] button. Select Variable Field… from the drop-down list.
- Select Location as the Variable, and Context as the Aspect. This will give the selected location as the code label. Press [OK] to return to the variable definition.
- Press [Tab] to move to the Values column. Enter Location=Location@context. The code used will be the code that equals the location specified by the context.
- Press [Tab] to move to the next Label field and enter Other sites. Then enter NOT(Location=Location@context) as the Value. This code will be used when the response does not equal the location specified by context.
- Press [Tab] to move to the next Label field and enter All sites. Then enter True as the Value.
- Click to save the context.
Create your comparison bar chart
This step describes how to set up a chart of the average spend at one restaurant against the other restaurants. You can find out more about means in Snap from the topic Means and medians.
- Click to display the Analysis Definition dialog for a chart.
- Select the chart style Bar Counts from the drop-down list.
- Type CComparison (your derived variable) into the Analysis field.
- Check the Transpose box.
- Select Means & Significances from the Calculate list and enter Q5 as the variable to use.
- Change to the Notes/Titles tab and click in the Title field
- Enter the title of your chart, using the [Insert] button to open the Variable field... dialog and insert the Label Aspect of Q5 and the Context Aspect of Location in the title.
- Clear the Chart Axis titles.
- Select the Base/Labels tab.
- Clear the Reports Include options (Description, Notes and Title).
- Click [Apply] to see your chart.
It will have no data for the subject as no context has been set.
- Select File | Context Values to open the Context Values dialog.
- Double click the global context value to open it. This allows you to set the context to a specific value.
- Set the Variable to Location and the Value to 1. This sets the current context to Bristol.
- Click to save the context.
- Click on the chart toolbar to update the chart. The context information will appear.
Put your bar chart in a report
The report will contain the title and the comparison bar chart.
- Click on the Snap toolbar to open the reports window.
- Click to create a new report. By default this will have a Tailor Analysis instruction in and nothing else.
- Add a label to your report so you know what it contains (e.g. Benchmark data by location).
- Click on the report dialog and select Information from the drop-down menu to add a new Information instruction.
- Enter the title for your report in the text pane. Leave the Title field blank (this is the title of the Instruction.). Style your title text by selecting text and using the format buttons.
- Click [OK] to save the instruction.
Add the benchmark chart to your report
- Click on the report dialog and select Execute from the drop-down menu to add a new Execute instruction.
- Click on the Execute dialog and select the comparison chart from the list.
- Click [OK] to add the Execute instruction to the report.
- Click to save the report.
This worksheet has described how to produce a comparison bar chart to use in a report, and then change the context to create multiple versions of the report from the same data. If you would like to see other examples of using contexts see Using contexts to provide personalised reports and questionnaires. If you would like other examples of means charts, see the worksheets Using scores to analyse satisfaction questions and Creating a combination chart to display respondent means as points and bars.
If there is a topic you would like a worksheet on, email to email@example.com