Sawtooth Software: The Survey Software of Choice

Ci3 Tech

This article contains tips and suggestions for using Ci3.

Question: How do I program skip questions based on "AND/OR" logic?

AND type logic can be done in two ways, through nested IF statements, or by adding "flag" variables. Suppose we have three questions that collect a numeric answer (Q1, Q2 and Q3), and we want to skip to a question called Q10 if the answer to all three of these questions was a 1. A nested If statement could perform such a skip:

     IF  (Q1  =  1)
          IF  (Q2  = 1)
               IF  (Q3  =  1)  SKIPTO  Q10
          ENDIF
     ENDIF

In each level of the IF statement, if the evaluation is "true," Ci3 moves to the next IF statement. If false, Ci3 skips out of the IF/ENDIF logic. If all three statements are true, SKIPTO Q10 will be executed. The indenting between lines is not required by Ci3, but simply makes it easier for humans to look at.

An alternative is increment a counter variable:

     X  =  0
     IF  (Q1  =  1)  X  =  X  +  1
     IF  (Q2  =  1)  X  =  X  +  1
     IF  (Q3  =  1)  X  =  X  +  1
     IF  (X  =  3)  SKIPTO  Q10

We initialize X to zero so that backing up over the question and changing the answers to Q1, Q2 or Q3 will correctly reset the counter. This example also illustrates a pattern that can be used for conducting "OR" logic. If we wanted to skip to Q10 if any of the answers to Q1, Q2 or Q3 was a 1, we would simply evaluate whether X > 0 in the last line of the previous example. And, using the same logic, if any two of the three questions was a 1, then X > 1.

Question: How do I show the current month or current day of the week during an interview?

In the pre-questionnaire section, create a list of months:

LIST  month
  January  
  February
  March
  April
  May
  June
  July
  August
  September
  October
  November 
  December
ENDLIST

Then, in your logic section, use the statement:

SHOW  month.SYSMONTH

Similar logic can be used to show the current day of the week with SYSDAY.