Helo,
I have a question asking total list of households in a villages. I want to random select a household an enumerators should start a data collection from the list (starting point) then continue with other households using a precalculated skip interval. For example, for example, my sample is 40/village so a village with 200 household will have 5 skip interval, but my question is from which household should enumerator start and continue with the interval of 5?
Thanks,
Welcome to the community, @fakhijr! I assume this is something you could manage through your sample frame.
Hello,
This is more a general survey/sampling question. I would start with a random number 1…5 for each enumerator in a village. You can use e.g. five small sheets of paper.
You might also think about replacements, e.g. if a HH don’t want to participate or cannot be contacted. And if/how you record those cases.
Hi @fakhijr
I agree with @wroos that this is more of a sampling logic before it becomes a scripting issue. The moment you address the sampling logic the easier it is to implement the scripting logic. Arguing as a researcher, I would say you are planning on a systematic random sampling approach. If this is the case then I would recommend the following steps.

Step 1: Get the total number of households and create a question e.g. HHCount

Step 2: Create a calculate question (${skipInt}) that determines the skip interval by using the formula ${HHCount} div 40

Step 3: Create a calculate question that determines random start number i.e. the first household to be sampled using the formula *once(int((${skipint}1)random())+1)

Step 4: Create a group containing 40 questions (remember your sample size?) that are follow a systematic addition of skipinterval to the random start number and then subsequently to the lasthousehold number.
I have worked out a sample form
RandomSelectionofHouseholds.xlsx (12.3 KB)
type  name  label  required  calculation 

start  start  
end  end  
integer  TotalHH  Total Households  TRUE  
integer  skipint  Skip Interval  false  ${TotalHH} div 40 
integer  RandomStartHousehold  Random Start Household  false  once(int((${skipint}1)*random())+1) 
begin_group  SelectedHouseholds  Selected Households  
integer  HH1  Household 1  ${RandomStartHousehold}  
integer  HH2  Household 2  ${HH1} + ${skipint}  
integer  HH3  Household 3  ${HH2} + ${skipint}  
integer  HH4  Household 4  ${HH3} + ${skipint}  
integer  HH5  Household 5  ${HH4} + ${skipint}  
integer  HH6  Household 6  ${HH5} + ${skipint}  
integer  HH7  Household 7  ${HH6} + ${skipint}  
integer  HH8  Household 8  ${HH7} + ${skipint}  
integer  HH9  Household 9  ${HH8} + ${skipint}  
integer  HH10  Household 10  ${HH9} + ${skipint}  
integer  HH11  Household 11  ${HH10} + ${skipint}  
integer  HH12  Household 12  ${HH11} + ${skipint}  
integer  HH13  Household 13  ${HH12} + ${skipint}  
integer  HH14  Household 14  ${HH13} + ${skipint}  
integer  HH15  Household 15  ${HH14} + ${skipint}  
integer  HH16  Household 16  ${HH15} + ${skipint}  
integer  HH17  Household 17  ${HH16} + ${skipint}  
integer  HH18  Household 18  ${HH17} + ${skipint}  
integer  HH19  Household 19  ${HH18} + ${skipint}  
integer  HH20  Household 20  ${HH19} + ${skipint}  
integer  HH21  Household 21  ${HH20} + ${skipint}  
integer  HH22  Household 22  ${HH21} + ${skipint}  
integer  HH23  Household 23  ${HH22} + ${skipint}  
integer  HH24  Household 24  ${HH23} + ${skipint}  
integer  HH25  Household 25  ${HH24} + ${skipint}  
integer  HH26  Household 26  ${HH25} + ${skipint}  
integer  HH27  Household 27  ${HH26} + ${skipint}  
integer  HH28  Household 28  ${HH27} + ${skipint}  
integer  HH29  Household 29  ${HH28} + ${skipint}  
integer  HH30  Household 30  ${HH29} + ${skipint}  
integer  HH31  Household 31  ${HH30} + ${skipint}  
integer  HH32  Household 32  ${HH31} + ${skipint}  
integer  HH33  Household 33  ${HH32} + ${skipint}  
integer  HH34  Household 34  ${HH33} + ${skipint}  
integer  HH35  Household 35  ${HH34} + ${skipint}  
integer  HH36  Household 36  ${HH35} + ${skipint}  
integer  HH37  Household 37  ${HH36} + ${skipint}  
integer  HH38  Household 38  ${HH37} + ${skipint}  
integer  HH39  Household 39  ${HH38} + ${skipint}  
integer  HH40  Household 40  ${HH39} + ${skipint}  
end_group 
PS; Changed your heading to help others find this topic easily
Stephane
Thanks all for the support. The script you @stephanealoo worked well and this is exactly what I wanted.
Cheers