Tagsets.Tableeditor Issue: Sorting Date Fields

Reply
Occasional Contributor
Posts: 7

Tagsets.Tableeditor Issue: Sorting Date Fields

I'm new to using Tagsets.Tableeditor, and while I'm seeing great potential use for it, I'm having an issue with the way date fields are being sorted. To provide some context, the data I'm using are being pulled from SQL Server in datetime format. I'm then using datepart to convert them to a SAS date format. Finally, I use the following code to generate HTML output:

ods tagsets.tableeditor file="c:\test.html"
    options(sort="yes"
            sort_arrow_color="blue"
            )
    style=styles.mystyle;


proc print data=sampledata label noobs;
run;

ods tagsets.tableeditor close;

The table looks great, and for all fields that AREN'T of date type, the sorting mechanism works perfectly. The issue is that the date fields don't appear to respond correctly to sorting. In particular, MISSING dates (which show up as a period) don't shift position when sorted. Ideally, I'd want missing dates to simply be clumped together, preferably AFTER the oldest date in the table. Does anyone have an idea as to why this is happening and how I might fix it? Any help would be greatly appreciated.

New Contributor
Posts: 2

Re: Tagsets.Tableeditor Issue: Sorting Date Fields

Hi Newnoise,

I also had a similar issue recently with the sorting of date field using the ODS tagsets in one of the webreports.  I have done the following steps to get the date sorting correctly.

1.)   1) Downloaded the latest version on  tagsets.tableeditor from the SAS website(http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/index.html)

2.)   

      2) Used the option “tagattr=” in the define statement for the date field.

Test Example :

     ods tagsets.tableeditor body=body  style=custom options (sort="yes" sort_arrow_color="red");

      proc report data=mydata nowd;

       column  subject group visitnumber visitdate ;

        define subject         /"Subject ID"   center;

        define group          /"Study Group"  center;

        define visitnumber   /"Visit Number"  center ;

        define visitdate    /"Visit Date" f=date9. center style(header)={tagattr='type="Date"'};

     run;

  ods tagsets.tableeditor close;

 

Even after downloading the latest version of tagset.tableeditor, the sorting of date was not coming properly. But after using the tagattr option, I was able to get the sorting of date correctly.

Hope this helps!

Thanks,

Merin

Occasional Contributor
Posts: 7

Re: Tagsets.Tableeditor Issue: Sorting Date Fields

Merin,

Thanks for the response! Unfortunately, I just tried it with my data, and it doesn't work. The problem is entirely with missing values. When you apply it to your data, are there any missing values in the date column?

Thanks again,
Ian

New Contributor
Posts: 2

Re: Tagsets.Tableeditor Issue: Sorting Date Fields

Hi Lan,

Yes, I had missing values in my data, but I didn't have the requirement of clubbing the missing dates together.

And I am not really sure how to get the desired sorting that you require for the missing dates using tagsets. What I have observed is that the dates will be sorted as per the month's order and the missing dates won't come clubbed in the sort while using tagsets.  Have you tried creating a sort order explicitly ( by using proc format or creating a sort variable in the dataset ) and apply the same in the column statement in proc report?

Thanks,

Merin

Ask a Question
Discussion stats
  • 3 replies
  • 303 views
  • 0 likes
  • 2 in conversation