Date: Thu, 30 Jul 2009 13:38:08 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: consistency of sorting a date or time var in num and char
you could also create your own datetime format:
low-high = "%Y-%0m-%0d:%0H:%0M:%0S" (datatype=datetime);
On Thu, 30 Jul 2009 12:20:59 -0500, Kevin Myers <KevinMyers@AUSTIN.RR.COM>
>Formatted order same as numeric:
>For date values: yymmddn8. or yymmdd10.
>For time values: tod11.2 (assumes your time values have hundredths of
>As far as I know, there is no built-in format for datetime values that
>produce the same sort order for formatted values as for the underlying
>numeric values. You would either have to roll your own or perhaps use an
>dtformatted = put(dt/86400,yymmdd10.)||" "||put(dt,tod11.2);
>Hope this helps.
>----- Original Message -----
>From: "Ya Huang" <ya.huang@AMYLIN.COM>
>Sent: Thursday, July 30, 2009 11:33
>Subject: consistency of sorting a date or time var in num and char
>> Hi there,
>> Obviously sorting a date var as numeric is different from a date9.
>> formatted character, since '03JAN2009' is ordered after '03APR2009'.
>> But '03JAN2009'DT should have the same order as '01032009'. For time
>> var, a time5. formatted string will not have the same order as the
>> underline numeric var, since time5. is not zero padded.
>> I wonder what kind of formatted date, time or datetime var have
>> the same order as the underline numeric var.