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 (August 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Aug 2002 14:23:21 -0400
Reply-To:     "Huang, Ya" <ya.huang@PFIZER.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@PFIZER.COM>
Subject:      Re: Need to sort an ARRAY
Comments: To: John Gober <j.gober@WORLDNET.ATT.NET>
Content-Type: text/plain; charset="iso-8859-1"

Since you have only 12 vars, why not use ordinal()?

12 data _null_; 13 array temp(12) temp1-temp12 (45,56,38,96,235,96,23,457,73,0,.,33); 14 do i=1 to 12; 15 put temp(i) @; 16 end; 17 put; 18 do i=1 to 12; 19 tempi=ordinal(i, of temp1-temp12); 20 put tempi @; 21 end; 22 run;

45 56 38 96 235 96 23 457 73 0 . 33 . 0 23 33 38 45 56 73 96 96 235 457 NOTE: DATA statement used:

You wouldn't see much difference between sophisticated sorting algorithm and this brute force method when you have only 12 vars to sort.

Kind regards,

Ya

-----Original Message----- From: John Gober [mailto:j.gober@WORLDNET.ATT.NET] Sent: Thursday, August 15, 2002 10:00 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Need to sort an ARRAY

This is probably a simple task but it illudes me now. I have an array containing 12 elements representing variables temp1 through temp 12. Is there some simple and easy method that anyone knows to sort the array elements in descending value (removing blanks and duplicates)?

Thanks in advance for any ideas and help.

John C. Gober


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