Statalist


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

Re: st: random split


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: random split
Date   Mon, 13 Apr 2009 10:43:59 +0200

<>

Weirdly enough, we failed to mention that -sample- can do it all pretty easily..

***
clear*
set obs 800
g x =rnormal()
sample `=100/3'
***


HTH
Martin
_______________________
----- Original Message ----- From: "Richard Williams" <Richard.A.Williams.5@ND.edu> To: <statalist@hsphsun2.harvard.edu>; "statalist" <statalist@hsphsun2.harvard.edu>
Sent: Monday, April 13, 2009 7:13 AM
Subject: Re: st: random split


At 03:48 PM 4/12/2009, Galina Hayes wrote:
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

Besides the other suggestions, check out Nick Cox's -swor- command, available from SSC.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   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