<>
*****
clear*
set obs 10000
g x=rnormal()
*give me a 30%/70% random split for "x"
g dummy=runiform()<0.3
*-keep- the 30% part
keep if dummy==1
drop dummy
*****
For more complicated splits, look at -cond- as well...
HTH
Martin
_______________________
----- Original Message -----
From: "Galina Hayes" <[email protected]>
To: "statalist" <[email protected]>
Sent: Tuesday, March 24, 2009 10:25 PM
Subject: st: MIME-Version: 1.0
Hello everyone,
What is the best way to randomly split a data set into groups of various
sizes?
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/