Querying and Data in a Looping Survey

Home / DatStat Illume Product Documentation / Queries / Querying and Data in a Looping Survey

Looping Explained

Conceptually Looping is the same as repeating a Collection of questions a number of times.  Think of each Collection as a survey in itself. Where there would be one row of data for a single submitted survey, each looping survey will create a number of rows.

 

For Example:

We will build a survey in pieces and discuss what is happening visually and in the

data.

  1. Starting with a simple survey of 3 questions. The last question being:  “How many people are in your household”?

If this were the only questions  in the survey, a submission would result in one row of data.

 

  1. Add a Loop Object of type Open-Ended.  Using a pipe from the question of how many in the household, we can set the minimum, and possibly maximum, to the number given.

Each Iteration of this loop asks for the name of that person.

There will be 2 Iterations because we answered 2 to the number in the household.

The two people are Beau and Sasha.

 

If this survey is taken once it will result in two rows of data

 

  1. Next we add a Nested Open-Ended Loop Object to the previous Object.  We need to add a final question to the list of questions in the first Loop Object.

The last question asks how many prescription drugs the person takes.

 

If this survey is taken once and the number given individuals is 2. The first person listed is

Beau and he takes 1 prescription medication.  The second person is Sasha and she takes  2 prescription medications. There will be 2 Loops of the questions within the

object.

 

This would result in 3 rows of data upon submission.

Beau has one row because of the 1 prescription medications

Sasha has two rows because of the 2 prescription medications

 

NOTE: Beau’s results would also be 1 if he had taken 0 prescription medications because there was only one iteration in the Nested Loop Object.

 

  1. Now we put a twist into this example.  We add a Follow-up Loop that asks 2 questions about each of the people listed in the first loop. Because there are no new individuals listed this example would not result in any additional rows of data. A single submission would still result in 3 rows of data.
  1. Continuing on, let’s add another loop, but this time a Pre-defined Loop.  This loop will have four pre-defined Loop Iteration Response Options.  This makes it behave like 4 different variables. So a single submit with the same information will now have 12 rows of data.  Beau had 1 and we multiply that by 4 to a total of 4.  Sasha had 2 multiplied by 4 for a total of 8.

 

Depending on how the loops are created and the number of responses, one submission could spawn many more rows of data than our example. When using Loops within a survey, careful and thoughtful querying is important to get at the data desired.

Queries with Loops

Querying the dataset of a survey that does not contain Loop Objects is straight forward because each respondent submission equates to one row. As we saw in the example above, adding Loop Objects can create many more rows of data for that one submission.

There are some Loop Object details that will make getting at the desired data easier:

All Iteration Types

  • Create queries that contain either all Non-Looped Variables or only Looped Variables
  • With looping, the selected variables will affect filtering

Open-Ended Loop

  • LOOP_OBJECT will give the total number of iterations for that loop
  • DATSTAT.LOOP_OBJECT.LOOP will contain the iteration for that Loop

Follow-Up Loop

  • LOOP_OBJECT will give the total number of iterations for that loop
  • LOOP_OBJECT.ANSWERED will either have Answered or Unanswered for that loop iteration in a Follow-up Loop

Pre-Defined Loop

  • LOOP_OBJECT will present a comma separated list of the Loop Response Options
  • LOOP_OBJECT.RESPONSE_OPTION lists Yes or No for was that iteration answered or not
  • DATSTAT.LOOP_OBJECT.LOOP will display the Response Option for that Iteration

Loop_RawData.gif