You are on page 1of 32

Proc du Jour:

PROC REPORT

Winfried Jakob, SAS Administrator


Canadian Institute for Health Information
Agenda
• Introduction
• What Can I Do with PROC REPORT?
• Some PROC REPORT Basics
• Examples
• How Can I Get Started?
Introduction
• PROC REPORT combines features of
– PROC PRINT
– PROC FREQ
– PROC MEANS/SUMMARY
– PROC TABULATE
– DATA step
Introduction
• PROC REPORT can produce a wide variety of
reports, and they can be nicely formatted, too
Introduction
• PROC REPORT can be used:
– With its own windowing environment (WYSIWYG)
– or simply by submitting code
What Can I Do with PROC REPORT?

• Detail reports
– One report line for every observation
– With or without summary lines
– Summary lines can be customized
What Can I Do with PROC REPORT?

• Summary reports
– Group totals
– Grand totals
– Group total or Grand total lines can be customized
What Can I Do with PROC REPORT?

• Highly customized reports


– Reports with trafficlighting
– Reports with imbedded hyperlinks
– Reports with imbedded graphics or images
PROC REPORT Basics
• To bring up the interactive REPORT window:

proc report data=rptdata.houses;


run ;
Report in REPORT window:
PROC REPORT Basics
• To create a report in the Output window:

proc report data=rptdata.houses nowd headline;


run ;
Report in Output window:
PROC REPORT Basics
• To create a report in HTML:

ods HTML file=“HOUSES Detail Report.htm”;

proc report data=rptdata.houses nowd;


run ;

ods HTML close;

• Similarly: RTF and PDF


PROC REPORT Basics
• To sort the rows: ORDER

proc report data=rptdata.houses headline nowd;


column style sqfeet bedrooms baths price;
define style / order ;
run ;
PROC REPORT Basics: Mixed Report
proc report data=rptdata.houses nowd headline;
column style bedrooms price new_price;
define style / order ;
define bedrooms / sum width=12 spacing=0 right;
define price / sum width=14 spacing=0 right;
define new_price / computed "New price"
format=dollar12.
width=12 spacing=0 right ;

compute new_price;
new_price = price.sum * 1.1;
endcomp;

break after style / ol skip summarize;

rbreak after / dol dul summarize;


run;
PROC REPORT Basics: Summary Report
proc report data=rptdata.houses ... nowd;
column style bedrooms price
price=min_price price=max_price price=avg_price;

define style / group format=$8. ... ;


define bedrooms / sum format=best9. ... ;
define price / sum format=dollar12. ... ;
define min_price / min format=dollar12. ... "Minimum price";
define max_price / max format=dollar12. ... "Maximum price";
define avg_price / mean format=dollar12. ..."Average price";

break after style / skip;

rbreak after / dol dul summarize;


run;
Examples
Example: Percentage Calculations

RTF PDF
Example: Sales Summary with Styles
Example: Superscripts
Example: Customized Report Break
Examples: Trafficlighting
How Can I Get Started?
Free Introduction:
SUGI 30 Paper 259 by Ben Cochran:
A Gentle Introduction to the Powerful REPORT Procedure
http://www2.sas.com/proceedings/sugi30/259-30.pdf

From SAS Publishing – the Crown Jewel:


Art Carpenter:
Carpenter’s Complete Guide to the
SAS Report Procedure
http://support.sas.com/publishing/

ISBN: 978-1-59994-195-0
PROC REPORT:
THOSE WHO LIKE IT,
LIKE IT A LOT
Acknowledgements
SAS and all other SAS Institute Inc. product or service names are registered
trademarks or trademarks of SAS Institute Inc. in the USA and other countries.
® indicates USA registration.

Other brand and product names are registered trademarks or trademarks of


their respective companies.
About the presenter
Winfried Jakob
SAS Administrator

Canadian Institute for


Health Information

495 Richmond Road, Suite 600


Ottawa, Ontario K2A 4H6
Canada

Phone: +1 (613) 694-6993


Fax: +1 (613) 241-8120
Email: wjakob@cihi.ca

http://www.cihi.ca

You might also like