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 (July 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 30 Jul 2006 11:09:14 +0200
Reply-To:     Hillel Vardi <hilel@BGU.AC.IL>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Hillel Vardi <hilel@BGU.AC.IL>
Subject:      Re: Randomly Sort a variable
Comments: To: Vishal Lala <vlala@PACE.EDU>
In-Reply-To:  <>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


Here is how to get as many random columns as you need without using any macro .

title Randomly Sort a variable. input program . loop i=1 to 12 . compute val=trunc(unifrom(200))+1. end case . end loop . end file . end input program . execute . formats val(f4). * >>>>>>>>>>>>>>>>>> change here to get as many copy as needed <<<<<< loop i=1 to 8 . xsave outfile=tmp.sav. end loop . get file=tmp.sav. compute var1=unifrom(2000000). sort cases by i var1 . add files file=* /first=start/by i . numeric seq(f4). leave seq. if start eq 1 seq=0. compute seq=sum(seq,1) . sort cases by seq i . CASESTOVARS /ID = seq /INDEX = i /seperator="" /drop=var1 start /GROUPBY = VARIABLE .

Hillel Vardi Ben Gurion U Israel

Vishal Lala wrote: > Hello, > > For a paper we are working on, I need to randomly sort data from one > column/variable into another. So, if the data in the mother > column/variable is 2, 7, 5, 9, 4, the data in the next column needs to be > randomly sorted like say 4, 5, 9, 7, 2. One way to do this is to create a > random id variable and sort based on that but the problem is that "Sort" > will change the sequence of all cases not just the column of interest. I > could copy and paste but this will take an inordinately long time for the > 10,000 random columns we have planned. I would greatly appreciate any > suggestions. > > thanks, > Vishal > > > Dr. Vishal Lala > Assistant Professor of Marketing > Pace University >

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