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 (January 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 1 Jan 2009 14:48:04 -0500
Reply-To:   Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:   Re: To find out the max value...
Comments:   To: Ian Whitlock <iw1sas@GMAIL.COM>

Ian,

While I don't know if "LARGEST was probably introduced for people who cannot count backwards" I, for one, am glad that LARGEST and SMALLEST were introduced.

I wanted to thank datanull earlier for reminding me about the functions but, unfortunately, Michigan State's bowl game had started (one does have to consider priorities). However, now that the game is at half-time, thanks datanull! I got to learn something new and the year isn't even one day old yet.

One of the benefits of the new functions, as compared to ORDINAL, is that the new functions don't consider missing values. I had been upset that the SAS 9 introduced CALLs' sortn and sortc order missing values first, without offering a work-around, but SMALLEST is perfect for that use as in:

data have; infile cards missover; input area1 area2 area3 area4 area5; cards; 10014 10001 10011 10024 10055 10004 10031 10005 10029 10006 10005 10005 10018 10012 10005 10003 10007 10023 ;

data want; set have; array a_area(5); do i=1 to 5; a_area(i)=smallest(i,of area:); end; run;

I'm sure there are numerous other potential uses where the difference in how missing values are treated make the added functions equally if not more important.

Art

p.s. Happy new year to you and everyone on the list -------- On Thu, 1 Jan 2009 12:57:43 -0500, Ian Whitlock <iw1sas@GMAIL.COM> wrote:

>Data _null_ ; > input Name $ a b c d e f ; > max1 = ordinal(6,of a--f); > max2 = ordinal(5,of a--f); > put name max1 max2 ; > cards; >Mahi 12 45 65 87 36 98 >Suri 32 20 54 86 47 100 >Nari 05 62 28 65 46 32 >;;;; > >LARGEST function is not listed in version 8 documentation, but ORDINAL >has been available for at least 25 years. LARGEST was probably >introduced for people who cannot count backwards. On the other hand, >it eliminates the need to know how many variables are involved. > >Ian Whitlock >=============== > >From "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>: > >On 1/1/09, Muthia Kachirayan <muthia.kachirayan@gmail.com> wrote: >> >> If you have V9, then you can use SORTN() function to sort the >variables. > > >You could use LARGEST function. > > >data have; > input Name $ a b c d e f ; > max1 = largest(1,of a--f); > max2 = largest(2,of a--f); > cards; >Mahi 12 45 65 87 36 98 >Suri 32 20 54 86 47 100 >Nari 05 62 28 65 46 32 >;;;; > run; >proc print; > run;


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