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
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