LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 20 Apr 2007 07:51:28 -0700
Reply-To:     "sophe88@yahoo.com" <sophe88@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "sophe88@yahoo.com" <sophe88@YAHOO.COM>
Organization: http://groups.google.com
Subject:      character variable sort order
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Good morning, all,

Here is what i have today. I do this very often

" proc sort data=old ; by id date;

data new; set old; by id date; if first.id ; run ; "

So I keep the earliest date record for each ID. Well, the variable date is a SAS date, just a number, no problem.

What if the variable is a character type like 24AUG2005:00:00:00? I thought we could not really rank a character variable (or can we?), so in this way I can not (or not ?) be sure the first.id result later is what I want (or not?).

I know the solution. Just use datepart function to strip the date out of it. What if it is more like:

by id lastname; run ; (assuming it makes sense)

Any thought is appreciated.

PD


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