Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Copyright © 2002 Pearson Education, Inc. Slide 1.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Copyright © 2010, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Chapter 13 Control Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Control Structures Conditional.
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
Copyright © 2007, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Copyright © 2010, SAS Institute Inc. All rights reserved. Advanced Business Analytics.
Copyright © 2006, SAS Institute Inc. All rights reserved. Shortcuts- what you may not know that can save you time! Elizabeth Ceranowski SAS Student Programs.
Section 1.1 Discrimination in the Workplace: Data Exploration.
Fundamentals of Variance Analysis Chapter 16 Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin.
Compound Interest and Present Value
Copyright © 2003 Pearson Education Canada Inc. Slide 7-91 Chapter 8 Flexible Budgets, Variances, and Management Control: II.
People © 2013 The Sleeter Group All rights reserved. Intuit, the Intuit logo and QuickBooks, among others, are registered trademarks of Intuit Inc. Other.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Copyright © 2006, SAS Institute Inc. All rights reserved. Randy Poindexter & Scott Huntley Output Delivery and Reporting An Introduction to ODS.
Copyright © 2010, SAS Institute Inc. All rights reserved. Define.xml - Tips and Techniques for Creating CRT - DDS Julie Maddox Mark Lambrecht SAS Institute.
Statistical Discovery. TM From SAS. JMP ® Software: Introduction to Categorical Data Analysis.
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
A Concise Display of Multiple Response Items Patrick Thornton.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
CHAPTER THREE Representing Data: Constants and Variables.
Copyright © 2008, SAS Institute Inc. All rights reserved. RMS Titanic: Using SAS Enterprise Guide To Report On A Tragedy Matt Malczewski, SAS Canada.
Niraj J. Pandya, Element Technologies Inc., NJ.  Summarize all possible combinations of class level variables even if few categories are altogether missing.
Section 6.2 Reading a Normal Curve Table HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2008 by Hawkes Learning Systems/Quant Systems,
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Copyright © 2010, SAS Institute Inc. All rights reserved. Applied Analytics Using SAS ® Enterprise Miner™
%rtf2data: A utility macro to convert RTF Table to SAS® dataset
Copyright © 2002, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Essential ODS PDF Patrick Thornton.
Copyright © 2013 Pearson Education, Inc. All rights reserved Chapter 10 Analysis of Variance Comparing More than Two Means.
CONTROL STRUCTURE The if, elseif, and else & switch Statements 1.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. Process Costing Chapter5 1.
Copyright © 2003, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Copyright © 2005, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
Join us on Twitter: #AU2014. Class summary text goes here Class summary.
Patrick Thornton SRI International.  Example of a Multiple Response Item ◦ Variable coding and example data  A Cross Tabulation using Proc REPORT 
Copyright © 2011 by John Wiley & Sons, Inc. All Rights Reserved Agenda Review chapter four Chapter quiz Discussion of quiz Opening activity Chapter five.
Financial and Managerial Accounting Wild, Shaw, and Chiappetta Fourth Edition Wild, Shaw, and Chiappetta Fourth Edition McGraw-Hill/Irwin Copyright © 2011.
Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Chapter Sixteen Control & Quality Control Improvement: Techniques for Enhancing Organizational Effectiveness McGraw-Hill/Irwin Copyright © 2013 by The.
Copyright © SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
CENTURY 21 ACCOUNTING © 2009 South-Western, Cengage Learning Chapter 6 Objectives 1.Define accounting terms related to a work sheet for a service business.
Tips for Mastering Relational Databases Using SAS/ACCESS®
Applied Business Forecasting and Regression Analysis
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
Joshua Klick, Economist, Bureau of Labor Statistics
Chapter 9 Financial Statements for a Sole Proprietorship
John J. Wild Sixth Edition
Reading a Normal Curve Table
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
PROC DOC III: Self-generating Codebooks Using SAS®
CM1847 Migrating AutoCAD Standards to Revit
A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets. Venkata N Madhira Senior Statistical.
Automate Repetitive Programming Tasks: Effective SAS® Code Generators
ATTN Presenters – please review and remove this slide from your PowerPoint deck before uploading.
Section 10.5 The Dot Product
Chapter 5 – Decisions Big Java by Cay Horstmann
Presentation Companion Slide Pack
Unit 4 Review Answers.
Introduction to SAS Essentials Mastering SAS for Data Analytics
SESSION TITLE Session # <insert number here> Date Month Year
SESSION TITLE Session #<insert number here> Date Month Year
Presentation transcript:

Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark 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 Compute Blocks Revealed Sandy McNeill

Copyright © 2003, SAS Institute Inc. All rights reserved. 2 Take all the guesswork out of finding the answers to life's more perplexing questions.

Copyright © 2003, SAS Institute Inc. All rights reserved. 3 Agenda  Uses of Compute Blocks  What do Compute Blocks look like?  Rules  Tricks/Traps  Questions

Copyright © 2003, SAS Institute Inc. All rights reserved. 4 What are the uses of Compute Blocks?

Copyright © 2003, SAS Institute Inc. All rights reserved. 5 Compute Block for Computed Variable

Copyright © 2003, SAS Institute Inc. All rights reserved. 6 Compute Block for Traffic Lighting

Copyright © 2003, SAS Institute Inc. All rights reserved. 7 Compute Block for Line Statements

Copyright © 2003, SAS Institute Inc. All rights reserved. 8 Compute Block Tied to Break

Copyright © 2003, SAS Institute Inc. All rights reserved. 9 What do Compute Blocks look like?

Copyright © 2003, SAS Institute Inc. All rights reserved. 10 As Simple As…. define balance / computed ; compute balance; balance=budget-actual; endcomp; compute before; totalaccts = 0; endcomp; OR

Copyright © 2003, SAS Institute Inc. All rights reserved. 11 As Cool As…. compute yrtodate; yrtodate=budget.sum-actual.sum; if yrtodate > 0 then call define( _col_, 'style', 'style={background=yellow}'); endcomp;

Copyright © 2003, SAS Institute Inc. All rights reserved. 12 As Complicated As….. compute after dept; pctbud = round((budget.sum/totalbud)*100); updept = upcase(dept); line pctbud 2. '% of YTD budget allocated to ' updept $varying. len '.'; if yrtodate < 0 then do; pctover = abs(round((yrtodate/budget.sum)*100)); text2 = ‘Over budget by ' || trim(left(put(pctover,3.0))) || '%.'; end; else text2=' '; line text2 $80.; endcomp;

Copyright © 2003, SAS Institute Inc. All rights reserved. 13 Rules of Operation

Copyright © 2003, SAS Institute Inc. All rights reserved. 14 Evaluation / Execution COL 1COL 2COL 3COL

Copyright © 2003, SAS Institute Inc. All rights reserved. 15 Values to the Left COL 1COL 2COL 3COL 4 Column 3 is a computed column Can’t use COL4 value in COL3 BUT….. You can write to columns to the left

Copyright © 2003, SAS Institute Inc. All rights reserved. 16 Analysis Variable “Dot” Syntax Weight.sum Height.median Weight.min Weight.max

Copyright © 2003, SAS Institute Inc. All rights reserved. 17 Where can you use a Compute Block?  Before / After report Compute before; Compute after;  For any report variable Compute weight;/* analysis variable */ Compute age;/* group or order variable */ Compute balance; /* computed variable */

Copyright © 2003, SAS Institute Inc. All rights reserved. 18 Where or With What Variable (cont)  Before / After a grouping Compute before age; Compute after age;  Before / After Page or Table Compute before _page_; Compute after _page_;

Copyright © 2003, SAS Institute Inc. All rights reserved. 19 Four Meanings of Analysis Vars  Compute before/after _page_  Detail lines  Compute before/after Grouping  Compute before/after (report)

Copyright © 2003, SAS Institute Inc. All rights reserved. 20 Compute Before / After _PAGE_ Compute Before _page_; Line ‘Budget.sum is ‘ budget.sum dollar12.2; Endcomp; Output looks like: Budget.sum is $40,000.00

Copyright © 2003, SAS Institute Inc. All rights reserved. 21 Compute Before / After _PAGE_ Compute Before _page_; Line ‘Budget.sum is ‘ budget.sum dollar12.2; Endcomp; Output looks like: Budget.sum is $40, Where does REPORT get the value for Budget.sum ?

Copyright © 2003, SAS Institute Inc. All rights reserved. 22 Answer: The value for budget.sum in the first detail line

Copyright © 2003, SAS Institute Inc. All rights reserved. 23 Detail Lines GROUP ANALYSISComputed Detail 1 Detail 2 Detail 3 Summary Compute Computed; Computed = Analysis.sum; Endcomp;

Copyright © 2003, SAS Institute Inc. All rights reserved. 24 Detail Lines GROUP ANALYSISComputed Detail 1 Detail 2 Detail 3 Summary Compute Computed; Computed = Analysis.sum; Endcomp; Where does REPORT get the value for Analysis.sum ?

Copyright © 2003, SAS Institute Inc. All rights reserved. 25 Detail Lines GROUP ANALYSISComputed Detail 1 Detail 2 Detail 3 Summary Compute Computed; Computed = Analysis.sum; Endcomp; Answer: From the value of Analysis.sum on the same detail line.

Copyright © 2003, SAS Institute Inc. All rights reserved. 26 Compute before/after Grouping GROUP1GROUP2ANALYSISComputed XXXXYYYY55 ZZZZ10 Compute After Group1. Val = 15 Detail 1 Detail 2 Break after group1 / summarize; Compute after Group1; Line ‘Compute After Group1. Val = ‘ analysis.sum 5.; Endcomp; Compute After Group1

Copyright © 2003, SAS Institute Inc. All rights reserved. 27 Compute before/after Grouping GROUP1GROUP2ANALYSISComputed XXXXYYYY55 ZZZZ10 Compute After Group1. Val = 15 Detail 1 Detail 2 Break after group1 / summarize; Compute after Group1; Line ‘Compute After Group1. Val = ‘ analysis.sum 5.; Endcomp; Compute After Group1 Where does REPORT get the value for Analysis.sum ?

Copyright © 2003, SAS Institute Inc. All rights reserved. 28 Compute before/after Grouping GROUP1GROUP2ANALYSISComputed XXXXYYYY55 ZZZZ10 Compute After Group1. Val = 15 Detail 1 Detail 2 Break after group1 / summarize; Compute after Group1; Line ‘Compute After Group1. Val = ‘ analysis.sum 5.; Endcomp; Compute After Group1 Answer: From the summarized value of Analysis.sum for this grouping. NOTE: Summary is implicitly done by REPORT.

Copyright © 2003, SAS Institute Inc. All rights reserved. 29

Copyright © 2003, SAS Institute Inc. All rights reserved. 30 Compute after ; GROUP1GROUP2ANALYSIS XXXXYYYY5 ZZZZ10 AAAABBBB15 Line Stmt After Report. Val = 30 Detail 1 Detail 2 Report Summary RBREAK after / summarize; Compute after; Line ‘Line Stmt after Report. Val = ‘ analysis.sum 5.; Endcomp; Detail 3

Copyright © 2003, SAS Institute Inc. All rights reserved. 31 Compute after ; GROUP1GROUP2ANALYSIS XXXXYYYY5 ZZZZ10 AAAABBBB15 Line Stmt After Report. Val = 30 Detail 1 Detail 2 Report Summary RBREAK after / summarize; Compute after; Line ‘Line Stmt after Report. Val = ‘ analysis.sum 5.; Endcomp; Detail 3 Where does REPORT get the value for Analysis.sum ?

Copyright © 2003, SAS Institute Inc. All rights reserved. 32 Compute after ; GROUP1GROUP2ANALYSIS XXXXYYYY5 ZZZZ10 AAAABBBB15 Line Stmt After Report. Val = 30 Detail 1 Detail 2 Report Summary RBREAK after / summarize; Compute after; Line ‘Line Stmt after Report. Val = ‘ analysis.sum 5.; Endcomp; Detail 3 Answer: From the summarized value of Analysis.sum for this report. NOTE: Summary is implicitly done by REPORT.

Copyright © 2003, SAS Institute Inc. All rights reserved. 33 Traps and Tricks

Copyright © 2003, SAS Institute Inc. All rights reserved. 34 “Dot” Syntax Analysis Variable. Statistic

Copyright © 2003, SAS Institute Inc. All rights reserved. 35 Computed Columns Under Across QUARTER DEPTQTR 1QTR 2 SalesActualBalanceSalesActualBalance Compute Balance; _c4_ = _c2_ + _c3_; _c7_ = _c5_ + _c6_; Endcomp; Column dept quarter,(sales actual balance); Define balance / computed;

Copyright © 2003, SAS Institute Inc. All rights reserved. 36 Computed Columns Under Across QUARTER DEPTQTR 1QTR 2 SalesActualBalanceSalesActualBalance Compute Dummy; _c4_ = _c2_ + _c3_; _c7_ = _c5_ + _c6_; Endcomp; Column dept quarter,(sales actual balance) dummy; Define balance / computed; Define dummy / noprint;

Copyright © 2003, SAS Institute Inc. All rights reserved. 37 Computed Columns Don’t Summarize GROUP ANALYSISCOMPUTED COLUMN Detail 1 Detail 2 Detail 3 Summary Compute computedColumn; computedColumn = 5; Endcomp; Rbreak after / summarize;

Copyright © 2003, SAS Institute Inc. All rights reserved. 38 Computed Columns Don’t Summarize GROUP1GROUP2ANALYSIS COMPUTED COLUMN XXXXAAAA5 YYYYBBBB5 CCCC5 15 Detail 1 Detail 2 Detail 3 Summary Compute computedColumn; If _break_ = ‘ ‘ then do; ComputedColumn = 5; total = total + ComputedColumn; End; Else computedColumn = total; Endcomp;

Copyright © 2003, SAS Institute Inc. All rights reserved. 39 Summary  Uses of Compute Blocks  What do Compute Blocks look like?  Rules  Tricks/Traps

Copyright © 2003, SAS Institute Inc. All rights reserved. 40