LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 26 Oct 2004 19:10:00 -0400
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Re: one random permutation

nyiann wrote: > Hi all, > > I have a set of data I want to randomize--essentially, just one random > permutation of the dataset. I guessd the easiest way to describe it > is shifting the fields up or down a random number of positions. Is > there an easy way to do this that anyone has done before? I can't > think of any easier way than to subset each field, randomize it, then > merge the fields together again.

Sort the table by a random value.

data foo; do rowid = 1 to 100; output; end; run;

%let seed=20041026;

* just one of the 100! permutations please;

proc sql; create table foo_randomized as select * from foo order by ranuni(&seed) ; quit;

-- Richard A. DeVenezia http://www.devenezia.com/


Back to: Top of message | Previous page | Main SAS-L page