Save random number


I’m using the public example of the random selection, but I want to save the random number generated for each item into the database, is that posible?

Also, is it posible that once the selection is made for the first time, it does not change when more people is added to the roster?

Thanks a lot.

Hello Luis, and thank you for the questions.

  1. Random number is already saved into the data without any further actions on your side. You will find it in the main data file in the column named ssSys_IRnd.

  2. No. Survey Solutions doesn’t make a selection. It recalculates expressions and it does that every time it is necessary. There is no user control over when this happens. You will need to introduce a question, such as “Are all members listed? (y/n)” and proceed to extension only once the positive answer is given. If the interviewer goes back and changes the list of the household members, that will refresh the selection, but you will find evidence of that in paradata.

Best, Sergiy

If you don’t add the question then you would not be able to distinguish between the following two situations when the last member was added
a) because he is indeed the last member
b) because the interviewer looked at who has been selected, and didn’t like it, and added a fake member.
Best, Sergiy

Thanks Sergiy!

If I don’t introduce that y/n question, I still could find evidence of multiple randomization exercises in paradata? or it’s necesary to add that question to do so?

@rowcode != selectedPersonRowcode

Many thanks for your answer.

Best regards!

Another question on this…

I’m following this article:

I want to refer to the rowcode of the selected person, but I think the random value is attached to the list, not to the member roster… And questions linked to list questions doesn’t support options filter…

How can I exclude the selected person from a single select question?

I created a variable (Long), with the expression:

It worked.

Thank you Sergiy!

Luis, the expression that you wrote will return randomRowcode if randomRowcode is a code of a person in your list or it will raise an exception. I don’t see how this is solving the question you’ve asked “How can I exclude the selected person from a single select question?”. Best, Sergiy

Yes. It is a code of a person in the list, so it worked fine. Then, I used that code to exclude the selected person from a roster.

Regarding to the first question… I want to save the random number generated for each item into the database, but the ssSys_IRnd column you mentioned is in the main table of the database, not in the members table, so I have 1 random number per household, not 1 random number for each member of the household… Is it posible to get that?

Yes, Luis, you can generate other random numbers utilizing the original value you obtain from Survey Solutions as a random starting point. I think you also confuse “saving” a value with “generating” it. My original advice was with respect to “saving” the value into the file. For generating, the simplest would be to precompute a reasonably long sequence and position randomly within it, then take N numbers as needed. Best, Sergiy