<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to sort by date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4775#M1525</link>
    <description>Hi, Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Your suggestion worked like a charm.  THANK YOU!!</description>
    <pubDate>Thu, 20 Sep 2007 16:18:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-09-20T16:18:55Z</dc:date>
    <item>
      <title>How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4769#M1519</link>
      <description>How does one sort records by date?  I've run my data through a Proc SQL step, and output the date fields in MMDDYY10. format - can this format then be sorted by date?  If not, what should I be doing instead?&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance....looking forward to your replies.</description>
      <pubDate>Tue, 18 Sep 2007 20:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4769#M1519</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T20:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4770#M1520</link>
      <description>Hmm.  I'm not really sure of the question.  The Filter and Query task has a tab for sorting that is pretty obvious, so I suspect that is not what you are asking.  Do you want the sorted output to look like&lt;BR /&gt;
&lt;BR /&gt;
09/17/2006&lt;BR /&gt;
09/17/2007&lt;BR /&gt;
09/18/2005&lt;BR /&gt;
09/18/2006&lt;BR /&gt;
...&lt;BR /&gt;
?&lt;BR /&gt;
&lt;BR /&gt;
If so, the only way I know to do that is to create a new variable that is the text representation of the date.  You can do that with the PUT function,&lt;BR /&gt;
PUT(orig_date_var,mmddyy10.) in the expression builder.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Doc Muhlbaier</description>
      <pubDate>Wed, 19 Sep 2007 12:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4770#M1520</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2007-09-19T12:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4771#M1521</link>
      <description>Hi, Doc, and thanks for replying.  What I've done, in a Proc SQL step, is to use the DATEPART function of a field that contains a SAS datea and Time value.  Once I got the DATEPART value, in a PROC SORT step, I then sorted the SAS numeric date value.  After that, I then had a PROC REPORT STEP, and that's where my dates go crazy.  I had PROC PRINT commands after both the PROC SQL and PROC SORT, and the dates looked great.  However, nothing in my report showed as being in a valid sequence, whether I used native SAS date format or an edited date format of MMDDYY10..&lt;BR /&gt;
&lt;BR /&gt;
That's the part that's driving me nuts.  Also, how might I go about putting the date into a text format to look like the format you suggested?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for responding and I look forward to hearing back from you.</description>
      <pubDate>Wed, 19 Sep 2007 15:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4771#M1521</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-19T15:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4772#M1522</link>
      <description>I wonder if your dates are going crazy because you are letting PROC REPORT think they're numeric vars that need to be grouped. For example, if you had this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define jobcode / group;&lt;BR /&gt;
define hiredate / 'Hire Date';&lt;BR /&gt;
define salary / 'Salary';&lt;BR /&gt;
[/pre]&lt;BR /&gt;
then the default "usage" for both hiredate and salary would be ANALYSIS, with the SUM statistic as the default.&lt;BR /&gt;
&lt;BR /&gt;
You might want:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define jobcode / group;&lt;BR /&gt;
define hiredate / order order=internal  'Hire Date';&lt;BR /&gt;
define salary / 'Salary';&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
or play around with the other possibilities for order (Internal, Formatted, Data...) which you can find in the documentation.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 19 Sep 2007 22:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4772#M1522</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-09-19T22:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4773#M1523</link>
      <description>Hi, Cynthia!  Would that also happen if I used ORDER to try to arrange the dates in the PROC REPORT segment?  I am going to play around with what you wrote...sounds interesting.&lt;BR /&gt;
&lt;BR /&gt;
You folks (you in particular) are wonderful in the help you provide.... thank you again.</description>
      <pubDate>Thu, 20 Sep 2007 14:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4773#M1523</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-20T14:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4774#M1524</link>
      <description>Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Duhhhh!  Please disregard my last question - my brain is definitely not awake this morning!  I saw you already had ORDER in your initial reply.  Sorry.....</description>
      <pubDate>Thu, 20 Sep 2007 14:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4774#M1524</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-20T14:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4775#M1525</link>
      <description>Hi, Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Your suggestion worked like a charm.  THANK YOU!!</description>
      <pubDate>Thu, 20 Sep 2007 16:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-by-date/m-p/4775#M1525</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-20T16:18:55Z</dc:date>
    </item>
  </channel>
</rss>

