BookmarkSubscribeRSS Feed
ncsthbell
Quartz | Level 8

I have a report that I am trying to sort the detail by a date column in ascending order.  The date is showing as a 'measure' coming from the information map.  I created the SAS datasets in EG 4.2 and passed into the Information map that feeds this report. The date shows as a data type of 'date' in the table.   I am doing a right click on the column name header on the report for this date solumn and selecting to sort ascending.  The data seems to be ordering in a character format rather than date format.  I am pretty new to SAS, so I am sure I am just missing something!!

Example of my data:

03/31/2006

03/31/2007

06/30/2006

06/30/2007

09/30/2006

09/30/2007

Need to have sorted as follows:

03/31/2006

06/30/2006

09/30/2006

03/31/2007

06/30/2007

09/30/2007

Thanks for any assistance with this problem!!

4 REPLIES 4
Tom
Super User Tom
Super User

I know nothing about Web Report Studio, but if you are using PROC REPORT then it has a "friendly" feature of sorting even numeric variables by the character string used to display then unless you tell it otherwise by using ORDER=INTERNAL option in addtion to the ORDER option.

define mydate / order order=internal;

twocanbazza
Quartz | Level 8

Have you searched the SAS web for say "WRS Date Sort order"?  There are a couple of SAS Notes, while not exactly the same, may shed som light on your issue.

Barry

art297
Opal | Level 21

I'm not familiar with WRS but, from what you show and the documentation, it appears that you might have identified month as a break variable and it is sorting on dates within months.

sks
Fluorite | Level 6 sks
Fluorite | Level 6

In the information map, you can set the format for the date field. I wonder if the issue is because the date field is showing up as a measure, can you change it to a category and see if data is sorted correctly.

Shri

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1640 views
  • 0 likes
  • 5 in conversation