Solved

SAS PROC REPORT

Posted on 2013-06-20
1
561 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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now