Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

SAS PROC REPORT

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
Lee R Liddick Jr
Asked:
Lee R Liddick Jr
1 Solution
 
theartfuldazzlerCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now