Date: Thu, 1 Apr 2010 20:11:41 -0500
Reply-To: Lou <lpogoda@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogoda@HOTMAIL.COM>
Organization: A noiseless patient Spider
Subject: Re: The problem with sorting MONYY7. data
"QiJun Fung" <email@example.com> wrote in message
> Hi all,
> I have a column "date" with type MONYY7.
> eg. Jun2004
No you don't. SAS has only two data types - character and numeric. You
have either a character variable with values like those you cite, or you
have a numeric variable associated with format MONYY7.
If it's a character variable, a sort will put the values in alphabetical
order. If it's numeric with an associated format, the underlying values are
the number of days since 01-Jan-1960, and a sort will put them in numeric
order, which for dates means chronological order.
> When I sort the data by "date", the order is by alphabetical order of
> the initial not by its time order.Then the result is like:
> How can I sort it by time order?
Chronologically, Apr2001 is before Apr2004, which in turn is before Jun2004.
For the values in your example, chronological and alphabetical order are the
same. And we can't tell if you're sorting character or numeric values from
> Thanks very much.