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 (April 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Apr 2004 14:56:17 GMT
Reply-To:     "(2B) || !(2B) Arin Chaudhuri" <spam@SPAM.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "(2B) || !(2B) Arin Chaudhuri" <spam@SPAM.NET>
Organization: Road Runner - NC
Subject:      Re: Unusual sorting problem
Content-Type: text/plain; charset=us-ascii; format=flowed

Richard A. DeVenezia wrote: > Richard A. DeVenezia wrote: [snip] > The normal sort is not what I want. > I need unusual sort such that rows within each by group of y are be ordered > by x, but the order is ascending and descending depending on y. Y is a > sequence 1,2,3,4... > y=1 x's=-5 to 5 > y=2 x's=5 to -5 > y=3 x's=-5 to 5 > y=4 x's=5 to -5 > ... > > (Think of an old bidirectional dot matrix printer, one line was printed > moving left to right and the next line was printed moving right to left.) >

data foo; retain seed 654321; do y = 1 to 38; do x = -5 to 5; satellite = ranuni(seed); disorder = ranuni(seed); output; end; end; run;

data bar; set foo; sortvar=(2*mod(y,2)-1)*_n_; run;

proc sort data=bar out=sorted_foo(drop=sortvar); by y sortvar; run;


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