Have an idea?

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

Set Value in Multiple Choice Question

I have a Question with 5 options in Multiple Choice Question,in 4 & 5 number option i want to set 98 & 99 respectively.
is it possible with Javascript or Perl Script or Anything other.
Thanks in advance
asked Feb 22 by Nouman Saeed Bronze (515 points)

1 Answer

+1 vote
You can use something like this to set the value of a check box ...
[%SetValue(Q1_10,1)%]

This will set Q1 code 10 to a "1" (as if you checked the check box).

This script can be placed into the footer of a question after Q1 has been answered. Make sure you are careful that the question you place it on is not skipped.

You can also apply Perl to this script if conditions apply.

Or are you referring to recoding as per the examples below ...

Q1_4 to Q1_98
Q1_5 to Q1_99

This can be done within the Data Management menu option.

Go to File | Data Management and then select the Export Data tab. Select your Job Name and then click Edit Selected Job. Click on the Recode button. Here you can add a recode definition. In this area you can recode your questions, lists and even other specify and exclusive codes like "None of the above".

Is this what you were after?
answered Feb 22 by Paul Moon Platinum (55,975 points)
Hi Nouman, these features (SetValue and the Data Management Recode tool) will not work in v6.6. They were introduced in a later version of Sawtooth Software (I believe v8 from memory).

In earlier versions, any recodes could be conducted within a free format question or at the analysis stage in whatever analysis software you use (e.g. SPSS, Excel).
This script  will recode Q1 in a free format hidden question according to the test file you sent me ...
<input name="HdQ1_RECODE" type="hidden" value="
[%
Begin Unverified Perl

 my $Q1_recode=0;

if ((VALUE("Q1_c1")>=1)&&(VALUE("Q1_c1")<=5))
 {
  $Q1_recode=VALUE("Q1_c1");
 }

elsif (VALUE("Q1_c1")==6)
 {
  $Q1_recode=98;
 }

elsif (VALUE("Q1_c1")==7)
 {
  $Q1_recode=99;
 }

 return $Q1_recode;

End Unverified
%]
">

Now you will use HdQ1_RECODE as your new Q1.
...