Desktop productivity for business analysts and programmers

Autofilters?

Reply
Contributor
Posts: 53

Autofilters?

Is there a way to have SAS create something similar to an autofilter in excel on a data output (list data or HTML output)? Is that even possible?
SAS Super FREQ
Posts: 8,819

Re: Autofilters?

Hi:
There are two ODS DESTINATIONS that will allow you to set autofilters:

1) TAGSETS.TABLEEDITOR -- creates an HTML file that can be viewed in a browser or in Excel

2) TAGSETS.EXCELXP -- creates an Excel Spreadsheet Markup Language file with the ability to set AUTOFILTER to on -- so that when the file is opened in Excel, you will see the AUTOFILTERS (this file cannot be opened in a browser, only with Excel)

However, neither of these destinations is automatically available to you under the EG choices for output types. You can create SAS code in an EG code node to use either of these two ODS destinations (assuming 1) you have SAS 9 on your server and 2) both tagset definitions are available on the server -- you will have to download both of these tagset definitions and make sure they're on the server before you use them).

For more information about TAGSETS.TABLEEDITOR:
http://www2.sas.com/proceedings/forum2008/258-2008.pdf -- contains code examples, such as this one:
[pre]
ods tagsets.tableeditor file="filename.html"
style=styles.printer
options(header_bgcolor="maroon"
header_fgcolor="white"
rowheader_bgcolor="maroon"
rowheader_fgcolor="white"
data_bgcolor="beige"
sort="yes"
autofilter="yes"
autofilter_width="4em");

proc print data=sashelp.class(obs=10);
title “Sort and filter columns”;
run;
ods tagsets.tableeditor close;
[/pre]

Note: the above code will NOT work until you have installed the TableEditor tagset template definition on your SAS installation or server.

For more information about TAGSETS.EXCELXP:
http://support.sas.com/rnd/base/ods/odsmarkup/

cynthia
Contributor
Posts: 53

Re: Autofilters?

Cynthia,

I'm getting the following error when attempting to install tableeditor.tpl. Is this an issue with my permissions or a SAS issue?
Frequent Contributor
Posts: 139

Re: Autofilters?

SAS EG is defaulted to make sasuser(readonly). To get around that you can put the template into work. So add this line

ODS PATH work.templat(update) sasuser.templat(read)
sashelp.tmplmst(read);
before your %include statemet. (%include 'C:\tableEditor.tpl'Smiley Wink

-Darryl
Contributor
Posts: 53

Re: Autofilters?

I just figured that out before you posted. Thanks anyways Darryl.

I added this code (before my %include):

ODS PATH work.templat(update) sasuser.templat(read)
sashelp.tmplmst(read);
Contributor
Posts: 53

Re: Autofilters?

My next question: Now that I've got the autofilters to work on an HTML output with the EGDefault style, is it possible to get autofilters to work on a custom style? I'm trying to use my own style, and the autofilters are not populating. Any ideas?
SAS Super FREQ
Posts: 8,819

Re: Autofilters?

Hi:
I think the best source for help on the Tableeditor tagset is in Tech Support. You might try there for help. You should be able to make it work with a custom style template.

cynthia
Ask a Question
Discussion stats
  • 6 replies
  • 226 views
  • 0 likes
  • 3 in conversation