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 (December 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Dec 2006 09:24:42 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: sorting problem

On Thu, 7 Dec 2006 02:08:43 -0800, gopilth@YAHOO.COM wrote:

>Hi, >I have a problem sorting data sets >data set A: >id score1 score2 >1 10 11 >1 10 20 >2 18 17 >3 11 13 >3 12 13 >4 10 19 >5 17 20 >5 21 20 > >out put file: >id score1 score2 >1 10 20 >2 18 17 >3 12 13 >4 10 19 >5 21 20 > >output should not have repeates of id's and should have highest score >(both in score1 and score2). >thanks in advance >gopi.

Your example is a special case. Whenever there are multiple observations for some ID value, either SCORE1 or SCORE2 is invariant within the group (eg,for ID=3, SCORE2=13 throughout, so that the choice can be made on the basis of SCORE1 values alone).

Suppose you have

ID Score1 Score 2

6 1 2 6 2 1

Should the output include the first observation, the second observation, or a composite (with SCORE1=2 and SCORE2=2). Or is there some other rule, such as picking the observation with the largest sum of SCORE1 and SCORE2? Or are you sure that the special property described above will always hold true in your data?


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