I'm trying to develop reports that display various descriptive statistics over time. There are too many time intervals (columns in these reports) to put all the stats together, so I'd like to stack them.
Example - for each measurement and grouping, I'd like to display
Statistic Interval1 Interval2 Interval3 .....
The formats of each cell depend on the measure and the statistic. With Proc Report I can put the statistics on the same row but it's not a good display with many intervals.
I can think of several ways to do this: with data _null_ and put statements, by transforming data into text and using proc prints, or by sending it to excel for where I could use macros for formatting. I'm sure there are many other ways, but I think there are many reasons to use proc report or tabulate if it's possible. The results will end up in a PDF so going to excel adds a layer of complexity that I'd rather avoid.
My questions: Is this possible in Report or Tabulate? Are there other techniques to try? Has a task like this been solved - e.g. in a user group presentation or a SAS paper or tutorial or somewhere else?
Recommend looking at PROC TRANSPOSE for creating column-oriented information for your "interval" values. Consider searching the SAS Support http://support.sas.com/ website for topic-oriented technical papers on the subject.
Even though this code is using SASHELP.CARS, imagine that where I have MAKE going across the columns, you would have your Interval variable. And then where I have MSRP and INVOICE going down the rows, you would have the variables for which you wanted descriptive statistics.
This might be easier to do with PROC TABULATE than PROC REPORT. Frequently when folks generate this kind of report with PROC REPORT, they "preprocess" the data with PROC MEANS first to get the descriptive statistics and -then- they use PROC PRINT or PROC REPORT on the output from PROC MEANS.
Anyway, here's some PROC TAB code to try. Note the use of the format modifier to give the N statistic a different format from the other statistics.
proc tabulate data=sashelp.cars f=comma12.2;
title '1) With Proc Tabulate';
where make in ('Acura', 'GMC', 'Buick');
var msrp invoice;
table msrp*(n*f=comma6. min max mean std)
invoice*(n*f=comma6. min max mean std),