This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help

Next Topic

Book Contents

Book Index

Tutorial 2: What is a context?

This section 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 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 tutorial 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.

Give your variables sensible names

It makes life much simpler if your variables have meaningful names.

  1. Open the Crocodile survey supplied with Snap.
  2. Click Variables window button on the Snap toolbar to display the Variables window.
  3. Find Q0 in the window.
  4. Double-click it to open the variable details.
  5. Change the Name from Q0 to Location. (You can safely do this as the name does not appear in the questionnaire.)

    Derived variable with insert button highlighted

  6. Click Save button to save the changes.

Set up the derived variable

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.

  1. Click New button on the Variables window toolbar to add a new variable.
  2. 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).

  3. Double click in the first code label and click the [Insert] button. Select Variable Field... from the drop-down list.

    Derived variable with insert button highlighted

  4. 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.

    New vaariable field getting context aspect

  5. 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.
  6. 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.
  7. Press [Tab] to move to the next Label field and enter All sites. Then enter True as the Value.

    New vaariable field getting context aspect

  8. Click Save button to save the context.

Create the 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.

  1. Click Chart button to display the Analysis Definition dialog for a chart.
  2. Select the chart style Bar Counts from the drop-down list.
  3. Type CComparison (your derived variable) into the Analysis field.
  4. Check the Transpose box.
  5. Select Means & Significances from the Calculate list and enter Q5 as the variable to use.

    Reference dialog chart q2 by q9

  6. Change to the Notes/Titles tab and click in the Title field
  7. Enter the title of your chart, using the [Insert] button to open the Variable field... dialog and insert the Name Aspect of Q5 and the Context Aspect of Location in the title.

    New vaariable field getting context aspect

  8. Clear the Chart Axis titles.

    Reference dialog titles with context and insert button

  9. Select the Base/Labels tab.
  10. Clear the Reports Include options (Description, Notes and Title).
  11. Click [Apply] to see your chart.

    Comparison bar chart for crocodile cafe locations: no context

    It will have no data for the subject as no context has been set.

  12. Select File|Context Values to open the Context Values dialog.

    Global context variable dialog

  13. Double click the global context value to open it. This allows you to set the context to a specific value.
  14. Set the Variable to Location and the Value to 1. This sets the current context to Bristol.

    Global context variable dialog: location bristol

  15. Click Save button to save the context.
  16. Click 1 2 3  button on the chart toolbar to update the chart. The context information will appear.

    Comparison bar chart for crocodile cafe locations: Bristol

Put the bar chart in a report

The report will contain the title and the comparison bar chart.

  1. Click Batches button on the Snap toolbar to open the reports window.
  2. Click New button to create a new report. By default this will have a Tailor Analysis instruction in and nothing else.
  3. Add a label to your report so you know what it contains (e.g. Benchmark data by location).
  4. Click New button on the report dialog and select Information from the drop-down menu to add a new Information instruction.
  5. 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.

    Information instruction with title

  6. Click [OK] to save the instruction.

Add the benchmark chart to your report

  1. Click New button on the report dialog and select Execute from the drop-down menu to add a new Execute instruction.
  2. Click on the Execute dialog and select the comparison chart from the list.
  3. Click [OK] to add the Execute instruction to the report.
  4. Click Save button to save the report.
  5. Run the report

See Also

Tutorial 1: Inserting dynamic text from analyses in reports

Tutorial 3: Creating tailored reports in Snap

Tutorial 4: Tailoring your data by using a context filter

Tutorial 5: Creating a simple context report and assigning it to associates