Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Skips are not working properly when there are don't know/refuse values

Hello all,

I have a series of 15 numeric 0/1 questions, named c760a-c760o.

Then there are two other questions q1 and q2, and which one is asked depends on the response to the earlier question.

If the sum of c760a-c760o is 0, q1 and q2 should be skipped. If the sum of c760a-c760o is 1, then q1 should be asked. If the sum of c760a-c760o is greater than 1, than q2 should be asked.

I've done this format for the skip logic
c760a + c760b + c760c + c760d + c760e + c760f + c760g + c760h + c760i + c760j + c760k + c760l + c760m + c760n + c760o = 1

When  c760a-c760o contain all 0/1 responses, than the skip patterns work fine. But when even one of the variables c760a-c760o is coded as -999, my refuse code, the skips are thrown off.

For example if the sum of c760a-760o is greater than 1, even if there is a missing value, then q2 comes up, which is correct. However if my sum of c760a-760o is 1, but one or more of c760a-c760o is coded as -999, then q1 is skipped and q2 is asked instead, which is not what I want.

I feel like the missing code may be being treated as a numeric value when I'm doing these sums. Is there any way to prevent that, or any other way I may be able to solve this issue involving refuse values?

I've also tried doing skips using jquery, and they're running into the same issues working with all 0/1 responses, but not if there are missing values.

Thanks so much!
Jake
asked Jan 30 by Jake Hammond (285 points)

1 Answer

+1 vote
One option is to update your skip logic to only sum up the non-refused answers, similar to this:

Begin Unverified Perl
my $sum = 0;
my @cQuestions = ('c760a', 'c760b', 'c760c');
foreach my $cQuestion (@cQuestions) {
    my $resp = GETVALUE($cQuestion);
    if ($resp != -999) {
        $sum += $resp;
    }
}
return $sum == 1;
End Unverified
answered Jan 30 by Zachary Platinum Sawtooth Software, Inc. (86,625 points)
Thanks!! I'm going to try this right now
Seems to be working, thanks so much!
...