C H A P T E R 1 Writing Reports with SAS



Similar documents
QUANTITATIVE METHODS CLASSES WEEK SEVEN

The example is taken from Sect. 1.2 of Vol. 1 of the CPN book.

June Enprise Rent. Enprise Author: Document Version: Product: Product Version: SAP Version:

Lecture 3: Diffusion: Fick s first law

5 2 index. e e. Prime numbers. Prime factors and factor trees. Powers. worked example 10. base. power

Question 3: How do you find the relative extrema of a function?

A Project Management framework for Software Implementation Planning and Management

FACULTY SALARIES FALL NKU CUPA Data Compared To Published National Data

Category 7: Employee Commuting

Architecture of the proposed standard

Continuity Cloud Virtual Firewall Guide

Free ACA SOLUTION (IRS 1094&1095 Reporting)

SPECIAL VOWEL SOUNDS

IHE IT Infrastructure (ITI) Technical Framework Supplement. Cross-Enterprise Document Workflow (XDW) Trial Implementation

Adverse Selection and Moral Hazard in a Model With 2 States of the World

Asset set Liability Management for

Econ 371: Answer Key for Problem Set 1 (Chapter 12-13)

Remember you can apply online. It s quick and easy. Go to Title. Forename(s) Surname. Sex. Male Date of birth D

Sci.Int.(Lahore),26(1), ,2014 ISSN ; CODEN: SINTE 8 131

Mathematics. Mathematics 3. hsn.uk.net. Higher HSN23000

Entry Voice Mail for HiPath Systems. User Manual for Your Telephone

HOW Interactive Design Conference Advanced HTML 5 / CSS 3 / jquery Chris Converse. codify kōd fī

The international Internet site of the geoviticulture MCC system Le site Internet international du système CCM géoviticole

by John Donald, Lecturer, School of Accounting, Economics and Finance, Deakin University, Australia

Category 1: Purchased Goods and Services

Repulsive Force

CPS 220 Theory of Computation REGULAR LANGUAGES. Regular expressions

WORKERS' COMPENSATION ANALYST, 1774 SENIOR WORKERS' COMPENSATION ANALYST, 1769

TIME MANAGEMENT. 1 The Process for Effective Time Management 2 Barriers to Time Management 3 SMART Goals 4 The POWER Model e. Section 1.

Lecture 20: Emitter Follower and Differential Amplifiers

(Analytic Formula for the European Normal Black Scholes Formula)

Parallel and Distributed Programming. Performance Metrics

AP Calculus AB 2008 Scoring Guidelines

GOAL SETTING AND PERSONAL MISSION STATEMENT

Using SAS s PROC GPLOT to plot data and lines

Logo Design/Development 1-on-1

Important Information Call Through... 8 Internet Telephony... 6 two PBX systems Internet Calls... 3 Internet Telephony... 2

Cookie Policy- May 5, 2014

Maintain Your F5 Solution with Fast, Reliable Support

STATEMENT OF INSOLVENCY PRACTICE 3.2

Use a high-level conceptual data model (ER Model). Identify objects of interest (entities) and relationships between these objects

Factorials! Stirling s formula

A Secure Web Services for Location Based Services in Wireless Networks*

union scholars program APPLICATION DEADLINE: FEBRUARY 28 YOU CAN CHANGE THE WORLD... AND EARN MONEY FOR COLLEGE AT THE SAME TIME!

A Multi-Heuristic GA for Schedule Repair in Precast Plant Production

REPORT' Meeting Date: April 19,201 2 Audit Committee

New Basis Functions. Section 8. Complex Fourier Series

Teaching Computer Networking with the Help of Personal Computer Networks

Entity-Relationship Model

Sample Green Belt Certification Examination Questions with Answers

Planning and Managing Copper Cable Maintenance through Cost- Benefit Modeling

EFFECT OF GEOMETRICAL PARAMETERS ON HEAT TRANSFER PERFORMACE OF RECTANGULAR CIRCUMFERENTIAL FINS

Contents. Presentation contents: Basic EDI dataflow in Russia. eaccounting for HR and Payroll. eaccounting in a Cloud

Keywords Cloud Computing, Service level agreement, cloud provider, business level policies, performance objectives.

81-1-ISD Economic Considerations of Heat Transfer on Sheet Metal Duct

Lift Selection Guide

Analyzing Failures of a Semi-Structured Supercomputer Log File Efficiently by Using PIG on Hadoop

Global Sourcing: lessons from lean companies to improve supply chain performances

CalOHI Content Management System Review

Book Publishing USER GUIDE. Made Easy. Part of the Digi USER GUIDE Series. Providing our customers with helpful print resources.

An Broad outline of Redundant Array of Inexpensive Disks Shaifali Shrivastava 1 Department of Computer Science and Engineering AITR, Indore

Family Health and Literacy

HOMEWORK FOR UNIT 5-1: FORCE AND MOTION

Incomplete 2-Port Vector Network Analyzer Calibration Methods

Budget Optimization in Search-Based Advertising Auctions

Cloud and Big Data Summer School, Stockholm, Aug., 2015 Jeffrey D. Ullman

UNIVERSITY OF NAIROBI SCHOOL OF COMPUTING & INFORMATICS IMPROVING APPLICATION OF KNOWLEDGE MANAGEMENT SYSTEMS IN ORGANIZATIONS:

Who uses our services? We have a growing customer base. with institutions all around the globe.

Combinatorial Analysis of Network Security

Fleet vehicles opportunities for carbon management

CPU. Rasterization. Per Vertex Operations & Primitive Assembly. Polynomial Evaluator. Frame Buffer. Per Fragment. Display List.

Dolphin Management 6. a u. h r. e D oc. n Sec. t GPS

606 EDUCATIONAL LEADERSHIP

Moving Securely Around Space: The Case of ESA

Category 11: Use of Sold Products

5.4 Exponential Functions: Differentiation and Integration TOOTLIFTST:

Basis risk. When speaking about forward or futures contracts, basis risk is the market

Fundamentals: NATURE OF HEAT, TEMPERATURE, AND ENERGY

YOU HAVE A MISSION WE HAVE TECHNOLOGY SAVING TIME TO BUILD YOUR CAMP S BOTTOM LINE

Version 1.0. General Certificate of Education (A-level) January Mathematics MPC3. (Specification 6360) Pure Core 3. Final.

Policies for Simultaneous Estimation and Optimization

A Theoretical Model of Public Response to the Homeland Security Advisory System

Business rules FATCA V. 02/11/2015

Data warehouse on Manpower Employment for Decision Support System

Business Systems Analysis with Ontologies

Traffic Flow Analysis (2)

Micro Satellite System

Usability Test of UCRS e-learning DVD

AQA. Physical Education. Questions and Answers

Title: Patient Safety Improvements through Real-Time Inventory Management

Real-Time Evaluation of Campaign Performance

Magic Message Maker Amaze your customers with this Gift of Caring communication piece

SPREAD OPTION VALUATION AND THE FAST FOURIER TRANSFORM

Abstract. Introduction. Statistical Approach for Analyzing Cell Phone Handoff Behavior. Volume 3, Issue 1, 2009

Why An Event App... Before You Start... Try A Few Apps... Event Management Features... Generate Revenue... Vendors & Questions to Ask...

Review and Analysis of Cloud Computing Quality of Experience

Caution laser! Avoid direct eye contact with the laser beam!

Introduction. Table of Contents Introduction... 1 Walk-through... 2 Teaching with Explore Our World Scope and Sequence... 26

Transcription:

C H A P T E R 1 Writing Rports with SAS Prsnting information in a way that s undrstood by th audinc is fundamntally important to anyon s job. Onc you collct your data and undrstand its structur, you nd to b abl to rport and summariz your findings ffctivly and fficintly. With SAS procdurs, SAS DATA stps, and SAS faturs such as th Output Dlivry Systm (ODS) and th macro facility, you hav th tools to succd at writing programs that analyz your data and crat rports. Using This Book This book prsnts xampls of SAS programs that solv many common rportwriting tasks. Th xampls rang from simply listing th obsrvations in a data st to computing summary statistics to crating customizd rports with SAS DATA stp statmnts to tailoring rport output by including ODS faturs. Each chaptr in this book groups rports of a similar typ as dscribd in Tabl 1.1. Tabl 1.1 List of Chaptr Topics Chaptr Topic Dscription 2 Dtail Rports List obsrvations. 3 Summary Rports Summariz obsrvations. 4 Customizd Rports Us SAS programming statmnts to customiz th prsntation of data. 5 Multipanl Rports Plac multipl rows of information sid-by-sid. 6 Enhancing Rports with ODS Faturs Apply ODS faturs to nhanc th formatting of rports. Each xampl includs th following information in this ordr: a brif statmnt of th goal of th xampl th rport output a tabl that lists th SAS cod faturs found in th xampl a dscription of th procss to solv th rport-writing task and a dscription of th data st that th xampl uss th SAS program that crats th output with annotations of th cod in th lft margin othr ways of solving th sam rport-writing task (optional) mor dtaild discussions of th spcial faturs of th xampl (optional) Th xampl data sts analyzd in this book wr dvisd to b structurally simpl so that th focus of ach xampl is th rport-writing tool rathr than th uniqu charactristics of th data st. S Appndix A, Crating th Exampl Data Sts, for dtails on th contnts of ach xampl data st.

2 SAS uid to Rport Writing: Exampls As you rad ach xampl, kp in mind how you can adapt th cod to rport rsults from your data sts. You can accss th data sts and programs prsntd in this book from th companion Wb sit for this book: support.sas.com/companionsits. Undrstanding SAS Rport-Writing Tools Most SAS procdurs produc output in a standard format. Two procdurs, REPORT and TABULATE, allow som customization of output layout. DATA stps and ODS faturs provid th most flxibility in customizing and slcting rport output. Th xampls in this book focus on th application of rportwriting procdurs, DATA stps, and ODS in producing rports. Whn writing a program to crat a rport, you nd to know which SAS procdurs spcializ in th kind of rport you want to produc. Rports can b catgorizd as dtail, summary, customizd, and multipanl. Exampls of ach ar shown in Figurs 1.1 through 1.4. Dtail rports list information at th obsrvation lvl of a data st (s Figur 1.1). Summary rports summariz obsrvations and produc output such as frquncy counts and dscriptiv statistics (s Figur 1.2). Customizd rports list information in a styl that is diffrnt than th standard output from a SAS procdur. Oftn ths ar producd with DATA stp programming (s Figur 1.3). Multipanl rports prsnt multipl rows of information sid-by-sid (s Figur 1.4). Som ovrlap dos xist btwn th catgoris. For xampl, a dtail rport may includ summaris, and a multipanl rport may contain dtail and summary information. Figur 1.1 Exampl of a Dtail Rport Study Hights and Wights ID ROUP ENDER HT WT AE 1 301 B F 64 110 32 2 302 A M 71 142 42 3 303 A M 72 206 34 4 304 B M 69 160 43 5 305 A F 65 138 32 6 306 A F 65 196 32 7 307 B M 70 242 40.. mor rows.

Chaptr 1 Writing Rports with SAS 3 Figur 1.2 Exampl of a Summary Rport Study Hights and Wights Hight(in) Wight(lb) Ag at Exam roup A B Man Std Man Std Man Std ndr Fmals 64.6 1.6 144 21.6 35.4 7.5 Mals 69.5 2.6 169 24.9 35.9 9.0 Fmals 65.9 2.6 139 21.4 36.2 7.3 Mals 69.5 2.7 169 20.0 36.6 8.5 Figur 1.3 Exampl of a Customizd Rport Study Hights and Wights roup A Mals Man Wight: 169 Man Hight: 69.5 roup B Mals Man Wight: 169 Man Hight: 69.5 TTst Rsults: Mals roup A vs roup B Wight: No significant diffrnc (p>0.05) TTst Rsults: Mals roup A vs roup B Hight: No significant diffrnc (p>0.05) roup A Fmals Man Wight: 144 Man Hight: 64.6 roup B Fmals Man Wight: 139 Man Hight: 65.9 TTst Rsults: Fmals roup A vs roup B Wight: No significant diffrnc (p>0.05) TTst Rsults: Fmals roup A vs roup B Hight: Significant diffrnc (p < 0.05) Figur 1.4 Exampl of a Multipanl Rport Study Hights and Wights r o u p ID n d r Ht Wt Ag r o u p ID n d r Ht Wt Ag r o u p ID n d r Ht Wt Ag B 301 F 64 110 31 B 339 F 65 143 34 A 377 F 66 152 33 A 302 M 71 142 42 B 340 M 68 181 26 B 378 M 69 176 53 A 303 M 72 206 34 A 341 M 66 168 44 B 379 F 64 127 41 B 304 M 69 160 43 B 342 M 70 171 44 B 380 M 66 174 52 A 305 F 64 138 32 B 343 M 68 168 31 B 381 M 69 154 39 A 306 F 65 196 32 B 344 M 71 162 24 B 382 F 66 135 41 mor rows.

4 SAS uid to Rport Writing: Exampls Tabl 1.2 prsnts an ovrviw of ach catgory of rport and th SAS procdurs bst suitd to produc rports of that typ. Tabl 1.2 Rport Typs and th Procdurs Usd to Produc th Diffrnt Typs Rport Typ Procdur/Stp Dscription Dtail PRINT Producs data listings quickly; can supply titls, footnots, and column sums. REPORT Offrs mor control and customization than PROC PRINT; can produc both column and row sums; has DATA stp computation abilitis. SQL Combins Structurd Qury Languag and SAS faturs such as formats; can manipulat data and crat a SAS data st in th sam stp that crats th rport; can produc column and row statistics; dos not offr as much control ovr output as PROC PRINT and PROC REPORT. MEANS, SUMMARY, UNIVARIATE Computs dscriptiv statistics for numric variabls; can produc a printd rport and crat an output data st. Summary PRINT Producs only on summary rport; can sum th BY variabls. REPORT Combins faturs of th PRINT, MEANS, and TABULATE procdurs with faturs of th DATA stp in a singl rportwriting tool; can also crat an output data st. SQL Computs dscriptiv statistics for on or mor SAS data sts or DBMS tabls; can produc a printd rport or crat a SAS data st. TABULATE Producs dscriptiv statistics in a tabular format; can produc multidimnsional tabls with dscriptiv statistics; can also crat an output data st. Customizd DATA Stp Producs highly customizd rports of all typs using SAS programming statmnts. Multipanl All procdurs whn snding output to a nonlisting dstination; REPORT whn snding output to ithr th LISTIN or a nonlisting dstination Producs sid-by-sid rports. Most xampls in this book us PROC REPORT and PROC TABULATE. A fw xampls us PROC PRINT and a fw xampls us DATA stps. On xampl uss PROC MEANS and anothr uss PROC FREQ. PROC FORMAT is usd throughout to add labls and othr information to th rports. Intgrating ODS and Rport Writing ODS is an intgral part of th rport-writing procss. It can b usd in all catgoris of rports to dsign th layout of a rport, improv th look of a rport, and slct th contnts of a rport. Th dfault dstination of your output whn you start your SAS sssion is LISTIN. Th LISTIN dstination is th traditional monospac SAS output. Th xampls in Chaptrs 2, 3, 4, and 5 ar writtn to snd output to th LISTIN dstination. Svral of ths xampls ar modifid in Chaptr 6 to snd output to nonlisting dstinations such as RTF and HTML.

Chaptr 1 Writing Rports with SAS 5 Associating Typs of Rports and th Exampls in This Book Appndix B, Cross-Rfrnc of th Exampls in This Book, prsnts a crossrfrnc of th xampls in this book to th typ of rport, procdurs usd, data sts usd, and ODS nhancd vrsions of th xampls. Th rows of Tabl B.1 in Appndix B list th xampls prsntd in Chaptrs 2 through 5. A tabl in th introduction to ach of th Chaptrs 2 through 5 rpats th prtinnt rows from Tabl B.1. Th xampls in Chaptr 6 ar drivd from th xampls in Chaptrs 2 through 5, and a tabl linking th xampls in Chaptr 6 to th original vrsions is prsntd in th introduction to Chaptr 6 and rpatd in Tabl B.2 in Appndix B. Using PROC SQL as a Rport-Writing Tool PROC SQL can also produc rports, but non of th xampls in this book apply this procdur to a rport-writing task. PROC SQL is a multipurpos procdur that is th SAS implmntation of Structurd Qury Languag. You can produc dtail rports with PROC SQL, but th rport formatting options in th procdur ar limitd. In th procss of crating your rport, you may find PROC SQL most usful in combining your data sts and obtaining intrmdiat rsults that ar includd in your final rports. For mor information on PROC SQL, s Th SQL Procdur in th Procdurs sction of Bas SAS 9.1 Procdurs uid. Displaying Rsults raphically Th xampls in this book concntrat on producing txt-basd tabls. Som imags ar includd in th txt rports in Chaptr 6, and on xampl in Chaptr 6 includs a programmatically drivd graphical rport. A pictur can b invaluabl in convying rsults. Whn you combin both picturs and txt in a rport, you can hlp your audinc bttr undrstand your rsults. Whil plotting data is byond th scop of this book, do not ignor this topic. Th bst rfrnc for prsnting data graphically is SAS/RAPH 9.1 Rfrnc. To gt startd in producing graphical rports, look for SAS Prss titls and SUI confrnc procdings, as dscribd in th Rfrncs sction of this chaptr. Ths rsourcs will hlp you combin graphs with th matrial you v larnd in this book.

6 SAS uid to Rport Writing: Exampls Writing a Rport Program in Fiv Stps Writing a rport can b an itrativ procss. You will likly find that it taks svral tris to produc th rport you nd. Bfor starting your rport program, mak sur you undrstand your data and th typs of information that th rport should convy. Do not concntrat on th styl attributs of th rport until you r sur you can produc th basic output. Thn aftr succssfully stablishing th structur of th rport, add th formatting faturs that improv th look and radability of your rport. Ths fiv stps can guid you in writing your rport programs. 1. Stat th information that th rport should convy. Writ sntncs that dscrib and xplain th contnts of your rport. 2. Sktch how th rport should look. Considr ths issus in planning your rport: What typ of rport is this dtail, summary, customizd, multipanl, a combination of typs? What dfins th columns of th rport variabls, computd variabls? What dfins th rows of th rport an obsrvation, summaris of obsrvations, groups of obsrvations? How should th rows b ordrd? What kind of annotation is ndd in th rport customizd lins, titls, footnots? 3. Undrstand your data. Considr ths issus whn you invstigat th contnt and structur of your analysis data sts: What data sts do you nd to produc th rport? How ar th analysis data sts structurd? Run PROC CONTENTS or viw th proprtis to rviw th attributs of th variabls in th data sts and th charactristics of th data sts, such as siz and sorting. List a fw obsrvations with PROC PRINT to s what th valus look lik. Whn producing a summary rport, run PROC FREQ on th variabls that dfin th catgoris in your rports to dtrmin th numbr of lvls and whthr valus should b groupd. This will hlp you prdict th physical siz of th final rport. Considr whthr PROC FORMAT would b usful in grouping th data. Run PROC MEANS to dtrmin rangs of valus. Is th physical structur of th data st in th sam orintation as th rport? Do you nd to rshap th data sts? What mthod should you us to rshap th data DATA stps, PROC TRANSPOSE, output data st from a procdur? Do you nd to combin data sts? How should you combin data sts MERE or SET statmnts in DATA stps, PROC APPEND, PROC SQL?

Chaptr 1 Writing Rports with SAS 7 Do you nd to comput nw variabls? If so, should you do this bfor you xcut th rport-writing procdur? If you r using PROC REPORT, you may not know th answr until you tst your PROC REPORT stp. Whn writing a DATA stp to produc a rport, you may b abl to comput th nw variabls and produc th rport in th sam stp. Do you nd to rarrang th ordr of th data for th rport? You may not know th answr to this qustion until you slct th rport-writing procdur. Say, for xampl, that your goal is to produc a dtail rport with ordrd rows. If you us PROC PRINT, your data st must b sortd or indxd in th propr ordr bfor you xcut PROC PRINT. If you us PROC REPORT, you may not hav to sort th data st bfor using th procdur. Options within PROC REPORT th ORDER or ROUP option on th DEFINE statmnt and th ORDER= option on th PROC REPORT statmnt will ordr th rows of your rport. 4. Slct th rport-writing procdur or dcid to us a DATA stp and, aftr rshaping th data sts as xplaind in Stp 3, writ th basic statmnts that construct th rport. Ensur that your program can construct th basic layout of th rport, and do not dwll on formatting th rport (formatting columns, adding labls, adding styl options, tc.). It may tak svral tris to achiv th rquird structur, and you may nd to rturn to Stp 3 to larn mor about your data sts, rshap th data sts, or comput nw variabls. Rfr to Tabl 1.2 for a list of which procdurs prform bst at which tasks. 5. Add formatting faturs to th rport. Considr whthr to add ths itms to improv th look of your rport: SAS dfind formats and usr-dfind formats titls, footnots, labls customizd lins styl attributs for fonts, spacing, bordrs, tc. customizd BY lins summary lins faturs spcific to th output dstination Your final rport program will likly b a hybrid of formatting faturs availabl within th procdur and thos that can b supplid with ODS spcifications. Rfrncs Th focus of this book is th prsntation of xampls, not th xplanation of syntax. Thrfor, it s important to hav rfrnc documntation availabl whn you rad this book. SAS 9 documntation is availabl onlin at support.sas.com/v9doc. Basic rfrncs usd for this book includ: SAS 9.1 Languag Rfrnc: Concpts SAS 9.1 Languag Rfrnc: Dictionary

8 SAS uid to Rport Writing: Exampls Bas SAS 9.1 Procdurs uid SAS 9.1 Output Dlivry Systm: Usr s uid Additional SAS xampls can b found in th many books availabl through SAS Prss. S th back of this book for a list of titls, and accss th SAS Prss Wb sit (support.sas.com/sasprss) for nwly rlasd and rvisd publications. Svral prsntations at SUI confrncs show how SAS usrs apply rportwriting tchniqus. Rcnt confrnc procdings ar availabl onlin, and thy provid a walth of additional applications and xampls. You can link to thm through th SAS support Wb sit (support.sas.com).