We are implementing an algorithm (in a macro) to randomly select a member of the household roster. As I understand that the variable evaluation (to hold the result of running the macro) will run every time interview is open (the selection will change as it is random).
Now, we want to freeze the result of the algorithm once a member was selected.
This member is selected for another interview and we need his data in both interviews.
I agree with @arthurshaw2002’s general point, but to clarify: whether a calculated variable changes depends on its components.Long story short: Could you share more details on your use case/scenario? That might help in finding a more tailored solution.Below some generic two cents.
Random Selection in an Interview:
A typical random selection is based on Quest.IRnd() and an interview specific data point, such as the list of household members (see here for example)., the random number is determined once when the interview is created. It does not change when reopening the interview - or any other action, it will always stay the same.
However, if the household member list changes, the result of the random selection also changes.
Preserving the Selection Across Interviews:
If you need the same selected member in a second interview, Survey Solutions does not provide a built-in way to “freeze” or automatically transfer the selection across interviews/questionnaires.
A practical workaround is to record the selected member manually (e.g., a printed sheet or another tracking mechanism) and enter the same selection in the second interview.
The selection will not change. The random value will remain the same, and correspondingly the selection of the member will also not change.
The real problem is not in the random value regeneration, but in the interviewers’ actions, that will try to manipulate the list after the selection. That is easily detectable.
The selection of the household member for individual interview should be random among qualified members (not the interviewer preference).
The random selection is controlled by parameters/preloads. The preloads allow to adjust member selection criterion as the survey progresses.
I think adding a question to record the selection as @peter_brueck suggested is a good work around.
@sergiy as I understand that variable evaluation is done when a question changes and with each closing and re-opening of the interview.
@sergiy Yes, We could inspect the paradata to detect interviewer manipulation.
Whether it is re-evaluated or not, there will be no additional randomness at subsequent evaluations. All the randomness is already realized at the time when the interview is created. Here we agree with @peter_brueck.
Peter has referred you to one of the questionnaires that I shared as public, but there is a different and more relevant public questionnaire: Public example Random Demo which corresponds exactly to your case.
Now, my recommendation would be of course to do exactly as that example suggests, and add the next section with questions to the selected individual within the same questionnaire.
Adding a validation to the question capturing the selected person will ensure that the interviewer gets notified (buzz) if/when the selection changes (e.g. if she goes to earlier sections and changes persons characteristics determining eligibility).
I still don’t see a case for the need to use “a printed sheet” though.