I would like tp restrict the number of dynamic value set to 5 from set of eligible cases, I have a listing of HHs that I want to dynamically
show 5 eligible cases out of the many from a lookup in a menu program.
onfocus
valueset hhVS;
forcase DVV_DICT where SELECT_CLUSTER=HCLUSTER and age > 18 do
// if …..endif //Random selection of 5 cases
hhVS.add(maketext(HHEAD) + " - " + strip(ADDRESS),HHNO);
endfor;
setvalueset(SELECTED_HH, hhVS);
Please is it possible to restrict the number of HHs in the codes above or there is a better way to do it. Thanks for the support always.
One thing you could do is add all of the eligible households to the value set and then do:
randomizevs(hhVS);
Then you could look at the first 5 entries in that value set. However, what's important with randomization is that you remember the settings from one run to the next. Once you've selected the five households, you may want to save those selections somewhere so that you don't get a different set of random households the next time you run your program.