I suspect that Rolf is looking for a permuted-block randomization scheme
for his 2-arm trial; i.e. he wants balanced assignment to study arms
within blocks (4 subjects to each arm in this case), but with random
permutations of the arm assignment order.
If I understand this correctly, you want to set up
a repeated list of identifiers and then shuffle it.
This illustrates some technique:
. set obs 800
. egen id = seq(), to(8)
. egen block = seq(), block(8)
. * or choose a different pie
. set seed 314159
. gen random = uniform()
. sort block random
. list block id
An alternative to -egen, seq()- is -egen, repeat()- on SSC.
That will repeat sequences other than contiguous integers.