Sunday, December 6, 2009

Dressing Up PROC REPORT

or PRINT, or FREQ or TABULATE, or . . . . far be it from me to re-start SAS PROC reporting wars ;-).

So lets say you have lots of reporting programs that you would like to make available on the SAS Portal. Since you already have SAS code and data to produce all the reports, you don't want to have to recreate them all using, for example, Web Report Studio (WRS).

But yet you do need/want some of the cool features that you've seen WRS can do, e.g.,
  • frozen column headers as you scroll
  • sorting the table on any column
  • and so on, and so on. . . .

One solution to this is to use the SAS TableEditor tagset.

The following simple program (which is run as a Stored Process) which summarizes/groups the data demonstrates this. Use the above link to find out what the various TableEditor options in the ods statement do. And, of course, there are lots, lots more options that that do all sorts of kewl things.



ods tagsets.tableeditor file = _webout
options(sort="yes" pageheight="300" pagewidth="490"
background_color="white"
frozen_headers="yes" frozen_rowheaders="yes");

proc report data = sashelp.shoes nowd
style(column) = [font_size=9pt]
style(header) = [font_size=9pt];
columns Region Stores Sales Inventory Returns;
define Region / group style(Header) = [tagattr="type='String'"];
define _numeric_ / sum style(Header) = [tagattr="type='Numberx'"];
footnote h=1 j=left 'Click on the Column Header to Sort the Rows in the Table';
run;
ods tagsets.tableeditor close;



Give it a test run on my server if you want to see this in action on the SAS Portal.

My next few posts will talk about how to package code like this using the macro facility in order to make it easy to run them as stored processes. I'll also talk about some other things you can do to make the code a bit glitzier.

Wednesday, December 2, 2009

Connecting Two Worlds

Since its inception, SAS has always been used by different folks with a completely different perspective on what it is and how it is used (e.g., Statisticians/Data Analyts and users who just crank out reports). Having seen this countably infinite times, it frustrates me when I see people building applications using the suite of tools available in the BI/EBI platform and commenting that Gee, I wish I could do XXXX where what they want to do is readily available in the Base SAS toolset.

Sooooo, I finally decided to create a blog to provide examples and tips to point out the (too many to count) cases where marrying these two worlds brings a lot to the table.

This blog is directed to both
  • the traditional SAS users who want to learn how their skill-sets might apply in the brave, new BI world.
  • BI/EBI developers and users, who perhaps only know about cubes, Web Report Studio, and so on. I hope to make them aware of all the great things you can do with simple SAS programs (packaged perhaps as Stored Processes).
So let the blogging begin. I know there are plenty of topics that I can address. Just need to find the time and the motivation!