Statalist


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

st: Re: MIME-Version: 1.0


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: MIME-Version: 1.0
Date   Tue, 24 Mar 2009 22:39:08 +0100

<>

*****
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" <galina@uoguelph.ca>
To: "statalist" <statalist@hsphsun2.harvard.edu>
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/



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