Solved

SAS PROC REPORT

Posted on 2013-06-20
1
592 Views
Last Modified: 2013-07-26
Working in SAS.  Need to create a report with basically column and row titles and then counts.  So the report would look like this:
                                        Region 1                 Region 2              Region 3
Total Hospitals                      6                            23                         21
Total Labs                             16                          34                         45
Total Rehabs                         3                             2                         22
Total Psych Units                  11                           5                         16
Grand Total                           35                          64                       104

Any examples in PROC PRINT or PROC REPORT to do this?  Each column to the left has a dataset with the counts
0
Comment
Question by:Lee R Liddick Jr
1 Comment
 
LVL 11

Accepted Solution

by:
theartfuldazzler earned 500 total points
ID: 39265085
Hi

I tend to prefer PROC TABULATE over PRINT or REPORT for this type of analysis.  TABULATE is quite a difficult to learn - but it is amazingly powerful.

Based on your question, there are multiple datasets, and I would do a summary function upfront to get the numbers:

PROC SQL;
  create view summary as
     select "Total Hospitals" as Type, Region, count(*) as Freq from Hospital group by 2
  union all
     select "Total Labs" as Type, Region, count(*) as Freq from Labs group by 2
;

PROC TABULATE DATA=Summary;
TABLE Type ALL="Grand Total", Region*Freq=" "*SUM=" ";
CLASS Type Region;
VAR Freq;
RUN;

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Index Details in SQL Server 2012 4 57
syadmin MSSQL 2 71
How do uses indexes to maximize MySQL Searches 14 55
physical_device_name field in SQL 3 30
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question