Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Random sorting


From   "David Radwin" <dradwin@mprinc.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Random sorting
Date   Thu, 27 Jan 2011 15:27:27 -0800 (PST)

Right. It only takes 2 lines, though 4 lines would be better. For example,

. set seed 12345
. tempvar sortorder
. gen `sortorder' = runiform()
. sort `sortorder'

David
--
David Radwin
Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794

www.mprinc.com


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Sarah Edgington
> Sent: Thursday, January 27, 2011 3:22 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: Random sorting
> 
> .
> You can create a random variable and sort on that. Look at the help for
> random-number functions.
> -Sarah
> 
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Laurie Molina
> Sent: Thursday, January 27, 2011 3:15 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Random sorting
> 
> Hi all,
> I would like to randomly sort my data set.
> And i cannot find a command to do that.
> Is there any?
> Thank you all in advance!
> LM
> *
> *   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/
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index