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 (May 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 26 May 2001 11:26:43 -0400
Reply-To:     Jay Weedon <jweedon@EARTHLINK.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jay Weedon <jweedon@EARTHLINK.NET>
Organization: http://extra.newsguy.com
Subject:      Re: Help: Sorting a SAS datastep array.
Content-Type: text/plain; charset=us-ascii

Use the ORDINAL function. For instance, LOW4=ORDINAL(4,OF A1-A15); provides the 4th lowest value, & HIGH4=ORDINAL(14,OF A1-A15); provides the 2nd highest value.

JW

On 26 May 2001 05:16:50 GMT, rich0850@aol.com (RICH0850) wrote:

>Dear Group: > >I have a problem which may have been answered before, if so please forgive me. >I need to sort a SAS data step array. SCL actually has a function to do this >(ASORT), but as far as I know, no equivalent exists for the data step. > >DATA A; > ARRAY BOB (15) A1-A15; > INPUT A1-A15; >CARDS; >1 9 5 8 4 9 9 4 3 10 11 4 7 5 3 >RUN; > >I need to find the largest 5 guys and the smallest 5 guys in A1-A15. My problem >may not actually need a sort (although a sort would be useful) but just some >means of cycling through the array and finding the top 5 and bottom 5. > >Any ideas? > >--Richard


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