Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Generating block randomation schedule using Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   Re: st: Generating block randomation schedule using Stata
Date   Wed, 27 Aug 2003 18:37:43 +0100

Rolf Klemm

> I want to generate a randomization schedule for a study with 2 arms
> for a sample size of 800 with a block size of 8, or 100 blocks of 8.
> Is there a way to do this in Stata?

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.

Nick
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index