Sawtooth Software: The Survey Software of Choice

Ci3 Tech

This article contains tips and suggestions for using Ci3.

Question: How do I program skip logic based on an item chosen from a randomized list?

Ci3 has very flexible language for managing randomized and constructed lists. When questions involve a "customized" list for each respondent, the MASTER instruction may be used to construct skip logic based on the responses.

When you program questionnaires with pre-defined lists (lists defined at the top of the questionnaire between LIST-ENDLIST instructions), Ci3 appends all of these lists into a single internal master list. For example, if we have three lists each with 10 items, the master list number of the first item on the third list is 21 (10 + 10 + 1). We can determine the master list number of any item chosen or referenced in a question by setting a variable equal to the master list number of a question name (with or without dot notation), text variable (such as listext or rostext), or list element. Here are some examples:

x  =  MASTER Q1
chos1  =  MASTER LISTEXT
ff2 = MASTER Q1list.2

The following example shows three brands of automobiles (in randomized order) and asks respondents to indicate their favorite. If the answer is "Honda," respondents are skipped to a question called "honda1."

LIST  brands
   Ford
   Honda
   Chevrolet
ENDLIST

Q:  Q1
T:  5  20
Which ONE of the following brands of 
automobiles do you MOST prefer?
I:
RANDOMIZE  brands  rbrands
SHOWLIST  rbrands  10  30  12  1
LOCATE  10  3  1
SELECT  3  1  1
x  =  MASTER  Q1
y  =  MASTER  brands.2
IF  (x  =  y)  SKIPTO  honda1

The variable x is set to the master list number of the item chosen in Q1. We set y equal to the master list number of the second item, Honda, in the "brands" list (brands.2). If this list were the only pre-defined list in the questionnaire, the master list number for Honda would always be 2. However, to ensure that the code works no matter how many lists occur before the "brands" list, we generalize the instructions to set y equal to the master list number of the second item in the brands list.

If Q1 were a multiple response question, we could set a variable equal to the master list number of the first item chosen (Q1.1) to nth item chosen (Q1.n).