Have an idea?

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

How to define groups based on given answers

I need to automatically generate groups where the respondent fits into.
Q1 -1 male - 2 female
Q2 - 1 25y or younger - 2 older than 25y

when a respondent selects Q1.1 and Q2.1, I want to place him in the variable group=1, Q1.1 and Q2.2 is group=2, ... Q1.2 and Q2.2 in group=4. This is a testing variable that needs to appear in the test mode, but be hidden for the respondents.

based on these groups, I need to set my skips for the next questions en my quota.

How does this work?

asked Feb 22, 2013 by anonymous

1 Answer

0 votes
You need to create a free format hidden question. Make sure Q1 and Q2 are answered first. Place the free format hidden question on any page after Q1 and Q2 and make sure the base of the page you place it on is consistent with the Q1 and Q2 base.

Here's an example (enter this code into the HTML box and name your variable HdGroup) ...

<input name="HdGroup_CODE" type="hidden" value="
Begin Unverified Perl

 my $Group_code=0;
if ((VALUE("Q1")==1) && (VALUE("Q2")==1))

elsif ((VALUE("Q1")==1) && (VALUE("Q2")==2))

elsif ((VALUE("Q2")==1) && (VALUE("Q2")==1))

elsif ((VALUE("Q1")==2) && (VALUE("Q2")==2))

return $Group_code;
End Unverified

When using this variable in skips, refer to HdGroup_CODE.
answered Feb 22, 2013 by Paul Moon Platinum (78,725 points)
Thank you for your quick reply. However my question has become more specific. Please let me give you the exact example:

Question SD (type of specialist – multiple selection)
1. Specialist 1
2. Specialist 2
3. Specialist 3
4. Specialist 4        
5. Specialist 5
6. Specialist 6

ONLY FOR specialist 1 (SD_1=1) AND specialist 2 (SD_2=1)
PB2        How many patients do you make treatment decisions for in xxx during a normal month?
      ___________ patients

ONLY FOR specialist 1 (SD_1=1) AND specialist 3 (SD_3=1)
PB3 For how many patients with xxx do you make treatment decisions for during a normal month?
___________ patients

Criteria to be allocated to the 7 groups:
 variable "Groups":
1. group1: SD_1=1 AND ((PB2>0 AND PB3=0) OR (PB2>0  AND PB3>0))
2. group2: SD_2=1
3. group 3: SD_4=1 OR (SD_4=1 and SD_2=1)
4. group 4:SD_1=1 AND ((PB2=0 AND PB3>0) OR (PB2>0  AND PB3>0))
5. group 5: SD_3=1
6. group 6: SD_4=1 OR (SD_4=1 and SD_3=1)
7. group 7: SD_5=1 or SD_6=1

Group 1 and 4 need to be randomly assigned if the respondent has patients in PB2 and PB3. Also group 3 and 6 need to be randomly assigned if only SD_4=1.

Could you please guide me through this?

Thank you in advance for your support.
I think you can create a quota question with you 7 cells (and the definition of each of them).
In the Advanced tab, you can select either "Randomize all" or "Randomize subset" in the "check for cell membership" section.
Then you will be able to refer to your groups as usual with [% quota_name