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 (February 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 4 Feb 2004 10:04:12 -0500
Reply-To:     "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject:      Re: If last question--data question
Content-Type: text/plain; charset="iso-8859-1"

What is your sort? by herdcode and testdate?

You want to keep all records where testdate = last.testdate?

data a; format herdcode 12. testdate date9.; input herdcode string testdate : mmddyy10.; cards; 427500065 99 09/20/03 427500065 01 11/14/03 427500065 02 11/14/03 427500065 90 11/14/03 427500066 04 12/14/03 427500066 05 12/15/03 427500066 92 11/14/03 run;

proc print; run;

proc sql; select a.* from a, ( select herdcode, max(testdate) as maxdate from a group by herdcode ) b where a.herdcode = b.herdcode and a.testdate = b.maxdate ; quit;

-----Original Message----- From: Crystal Vierhout [mailto:vierhout@UNITY.NCSU.EDU] Sent: Wednesday, February 04, 2004 9:53 AM To: SAS-L@LISTSERV.UGA.EDU Subject: If last question--data question

Hello,

I have a little question concerning a "if last" question.

I have.... herdcode string testdate 427500065 99 09/20/03 427500065 01 11/14/03 427500065 02 11/14/03 427500065 90 11/14/03

I need.... herdcode string testdate 427500065 01 11/14/03 427500065 02 11/14/03 427500065 90 11/14/03

I've tried if last.XXX but am loosing the string 01 and 02. I've tried the nodup key but not working the way I need. I've tried a retain but not able to get to work....

Thanks

Crystal


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