Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: random split


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: random split
Date   Sun, 12 Apr 2009 22:54:00 +0200

<>


***
clear*

*create xmpl dataset
set obs 800
g x=rnormal()

*indicator splitting dataset 2:1
gen byte myindicator=runiform()<`=1/3'
ta  myindicator
****


HTH
Martin
_______________________
----- Original Message ----- From: "Galina Hayes" <galina@uoguelph.ca>
To: "statalist" <statalist@hsphsun2.harvard.edu>
Sent: Sunday, April 12, 2009 10:48 PM
Subject: st: random split


Hello everyone,
I want to randomly split a data set of 800 or so observations into two groups, with 1/3rd of observations in the first group and 2/3rds in the second group, and am blanking on how to do this. Can anyone help?
Thanks,
Galina
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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