0 votes
in SoSci Survey (English) by s252372 (185 points)

Dear all,

I would like to randomize a treatment and I want the random number to be drawn only for some of the respondents, i.e. conditional on them answering a given option (option 1 in my example).
I don't want the number to drawn if the respondent is answering any other option (2, 3, 4 and residual option in my case).

Based on https://www.soscisurvey.de/help/doku.php/en:create:randomization-per-block
I thought it would be enough to write the follwing code to achieve what I need

if (value('E001') == 1) {
// Randomize priming treatment
show('PR01');
put('PI01_01', value('PR01'));
}

However, when I do the preview, I can see that the number is drawn also if I select a different option from 1...
Note that this is a multiple choice question and it seems that this detail matters because when I select the single selection format, the draw works as I want (although then, when I select an option different from 1 I get that "The variable PI01_01 has not been asked on a previous page during this interview. Therefore value() cannot determine any answer, yet".) In either case I need the question to be multiple choice.

I would be greatful for any suggestion

1 Answer

+1 vote
by SoSci Survey (306k points)

Would you mind, posting your debug information for that page?

The most likely explanation is that you have places PR01 on the page via drag & drop. If that is the case, remove it, and leave only the show() to draw a number.

Note that this is a multiple choice question

Okay, then you're using the wrong variable. E001 will tell you how many options have been checked. I think your filter should be (value('E001_01') == 2).

Take a look in the variables listing to get more comfortable with the variables.

by s252372 (185 points)
Thank you very much!

"I think your filter should be (value('E001_01') == 2)" solved the issue, the number is drawn only for option 1.

One further clarification:
I don't need the internal variable to record anything else, but since I get the warning message (below*) when a different option is selected, I wanted to double check if this could be problematic and if you recommend to do something about it


*The variable PI01_01 has not been asked on a previous page during this interview. Therefore value() cannot determine any answer, yet
by SoSci Survey (306k points)
If you do not need the put() line, you can simply remove it. That would be useful, if you wnated to store "something else" in the Variable, if the option 1 was not checked.

The error message sound like you have change the put() line as well, or are using a value('PI01_01') somewhere else in the questionnaire, and the put() line did not run, because the option 1 was not checked.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...