The SAS Output Delivery System and reporting techniques

Can Proc Report or Tabulate do this?

Occasional Contributor EdB
Occasional Contributor
Posts: 9

Can Proc Report or Tabulate do this?

Hello all:

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?

Super Contributor
Super Contributor
Posts: 3,176

Re: Can Proc Report or Tabulate do this?

Recommend looking at PROC TRANSPOSE for creating column-oriented information for your "interval" values. Consider searching the SAS Support website for topic-oriented technical papers on the subject.

Scott Barry
SBBWorks, Inc.
Posts: 9,368

Re: Can Proc Report or Tabulate do this?

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.


ods listing close;
ods rtf file='c:\temp\desc_stats.rtf'

proc tabulate f=comma12.2;
title '1) With Proc Tabulate';
where make in ('Acura', 'GMC', 'Buick');
class make;
var msrp invoice;
table msrp*(n*f=comma6. min max mean std)
invoice*(n*f=comma6. min max mean std),
make all;

ods rtf close;
Occasional Contributor EdB
Occasional Contributor
Posts: 9

Re: Can Proc Report or Tabulate do this?

Thanks - this is exactly what I was hoping for!

I'm reporting medians and quartiles for the totals and medians for subgroup results and Report is working well for the subgroups displays, but this will be perfect for the summaries.

Thanks again
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation