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

st: RE: Re: random allocation [was:RE: programming question]


From   "Banya, Winston" <w.banya@imperial.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: random allocation [was:RE: programming question]
Date   Mon, 3 Nov 2003 12:24:25 -0000

Many thanks Nick.

-----Original Message-----
From: Nick Cox [mailto:n.j.cox@durham.ac.uk]
Sent: 03 November 2003 12:00
To: statalist@hsphsun2.harvard.edu
Subject: st: Re: random allocation [was:RE: programming question] 


Consider the results of 

. set seed 31103
. set obs 10 
. gen id = _n 
. gen random = uniform()
. sort random 
. gen treatment = cond(_n <= 5, "A", "B") 
. sort id 
. l id treatment 

Nick 
n.j.cox@durham.ac.uk 

Banya, Winston
 
> Can someone pleases show me the command if any that 
> randomly allocates 2
> treatments for example to say 10 people. I need to assign 2 
> treatments A and
> B to 10 people in equal numbers.
> 
> I was wondering that if the first line is 
> 
> set obs 10, then what will follow for the random allocation?
> 

*
*   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/
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index