FROM THE TESTING TRENCHES COMMON LOGIC LAPSES AND HOW TO AVOID THEM.

Slides:



Advertisements
Similar presentations
Haas MFE SAS Workshop Lecture 3:
Advertisements

Examples from SAS Functions by Example Ron Cody
1 Combining (with SQL) HRP223 – 2010 October 27, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 14 – Student Grades Application: Introducing.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design Copyright 2000 © John Wiley & Sons, Inc. All rights reserved. Slide 1 Key.
Introduction to Structured Query Language (SQL)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 4 – Creating New.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Copyright © 2008, SAS Institute Inc. All rights reserved. RMS Titanic: Using SAS Enterprise Guide To Report On A Tragedy Matt Malczewski, SAS Canada.
1 Access for non-experts Link tables Find fields Criteria Join tables Find missing comment lines Understand relational databases (Wow!)
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Prepared by: Luigi Muro – Consultant
Lesson 2.  To help ensure accurate data, rules that check entries against specified values can be applied to a field. A validation rule is applied to.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
SAS Macro: Some Tips for Debugging Stat St. Paul’s Hospital April 2, 2007.
INTRODUCTION TO SAS MACRO PROCESSING James R. Bence, Ph.D., Co-Director Quantitative Fisheries Center Professor Department of Fisheries and Wildlife March.
SAS ® PROC SQL or Vanilla Flavor Cecilia Mauldin January
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
4 Copyright © 2006, Oracle. All rights reserved. Restricting and Sorting Data.
Type presentation name here in slide master © 2007 SDL. Company Confidential. Forward-looking information is based upon multiple assumptions and uncertainties.
Copyright Curt Hill SQL Queries Yet Another Set of Query Features.
Digital Image Processing Lecture10: MATLAB Example – Utility M-functions for Intensity Transformations.
1 Lab 2 and Merging Data (with SQL) HRP223 – 2009 October 19, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
Presenter Name Title Organization Twitter Handle Insert your logo here, then delete text.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Macro Variable Resolution Enio Presutto York University, Toronto, Canada.
Figure 4–1 Application of commutative law of addition. Thomas L. Floyd Digital Fundamentals, 9e Copyright ©2006 by Pearson Education, Inc. Upper Saddle.
Copyright © 2004, Oracle. All rights reserved. Lecture 4: 1-Retrieving Data Using the SQL SELECT Statement 2-Restricting and Sorting Data Lecture 4: 1-Retrieving.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
Click to add Presentation Title Arial 32, 5 line max title space line 3, title space line 4, title space line 5 Presenter Title Organization Insert your.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 4: Making Decisions.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
2 Copyright © 2009, Oracle. All rights reserved. Restricting and Sorting Data.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
B Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Working with PDF and eText Templates.
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Beginning Data Manipulation HRP Topic 4 Oct 14 th 2012 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
Dynamic SQL Writing Efficient Queries on the Fly ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Working Efficiently with Large SAS® Datasets Vishal Jain Senior Programmer.
Copyright © SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Creating Database Objects
Truth Tables & Logic Expressions
Writing Basic SQL SELECT Statements
Dynamic SQL Writing Efficient Queries on the Fly
1 Topic Title First slide 2 line 3 line 4 line
Presenter Name Title Organization.
Lab 3 and HRP259 Lab and Combining (with SQL)
Combining (with SQL) HRP223 – 2012 November 05, 2011
Lesson 3 Chapter 10.
1 Session Title 2 line 3 line 4 line
1 Topic Title First slide 2 line 3 line 4 line
Truth Tables & Logic Expressions
Creating Database Objects
Presentation transcript:

FROM THE TESTING TRENCHES COMMON LOGIC LAPSES AND HOW TO AVOID THEM

2 Copyright © 2014, SAS Institute Inc. All rights reserved. DISCLAIMER The views and opinions expressed in the following PowerPoint slides are those of the individual presenter and should not be attributed to the Research Triangle SAS Users Group, or any organization with which the presenter is employed or affiliated. These PowerPoint slides are the intellectual property of the individual presenter and are protected under the copyright laws of the United States of America and other countries. Used by permission. All rights reserved.

3 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IS A LOGIC LAPSE? Code runs without error Output looks reasonable Log files look reasonable Off to QA for testing and …

4 Copyright © 2014, SAS Institute Inc. All rights reserved. KA-BOOM!

5 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date

6 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE…

7 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX… Apply date format to date variable select IssueDate format=DATE9. as Issue_Date Create DATETIME variable and apply DATETIME format select dhms(IssueDate,0,0,0) format=DATETIME23. as Issue_DTTM

8 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats

9 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE…

10 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX…

11 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly

12 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE…

13 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX…

14 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity

15 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… 9 proc sql; 10 create table Case_Example_1 as 11 select City,County,State,ZIP 12 from Case_Example 13 where city="RALEIGH"; NOTE: Table WORK.CASE_EXAMPLE_1 created, with 0 rows and 4 columns. 13 ! quit;

16 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX… 15 proc sql; 16 create table Case_Example_2 as 17 select City,County,State,ZIP 18 from Case_Example 19 where upcase(city)="RALEIGH"; NOTE: Table WORK.CASE_EXAMPLE_2 created, with 44 rows and 4 columns. 19 ! quit;

17 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks

18 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… 15 proc sql; 16 create table Example_1 as 17 select distinct a.ncgeneralstatute || ' - ' ||b.ncgeneralstatutedescription as NCGS_CAT 18 from extract.sor_offense as a 19 left join extract.sor_refncstatute as b 20 on a.ncgeneralstatute=b.ncgeneralstatute 21 ;

19 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX… 23 proc sql; 24 create table Example_2 as 25 select distinct catx(' - ', a.ncgeneralstatute,b.ncgeneralstatutedescription) as NCGS_CATX 26 from extract.sor_offense as a 27 left join extract.sor_refncstatute as b 28 on a.ncgeneralstatute=b.ncgeneralstatute 29 ;

20 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters

21 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… 31 proc sql; 32 create table Hex_Example_1 as 33 select * 34 from Hex_Example 35 where upcase(city)="RALEIGH"; NOTE: Table WORK.HEX_EXAMPLE_1 created, with 0 rows and 5 columns. 35 ! quit;

22 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX… 37 proc sql; 38 create table Hex_Example_2 as 39 select * 40 from Hex_Example 41 where upcase(compress(city,,'ak'))="RALEIGH"; NOTE: Table WORK.HEX_EXAMPLE_2 created, with 44 rows and 5 columns. 41 ! quit;

23 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters Incorrect handling of endpoints

24 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… Greater than versus Greater than or equal to Less than versus Less than or equal to Less than versus Greater than LE versus GE Displaying age

25 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX… Query test data for cases where date falls inside or outside test range where date matches endpoints where birthday matches test date where date is missing

26 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters Incorrect handling of endpoints Incorrect sorting (primary/secondary/tertiary)

27 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE…

28 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters Incorrect handling of endpoints Incorrect sorting (primary/secondary/tertiary) Losing data when converting text strings to SAS dates

29 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… All digits, but invalid date (leap day in non-leap years) Missing digits and/or spaces Unexpected characters 20?? &A Nonexistent dates

30 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX…

31 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSES Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters Incorrect handling of endpoints Incorrect sorting (primary/secondary/tertiary) Losing data when converting text strings to SAS dates Not imposing integrity constraints on input parameters

32 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE…

33 Copyright © 2014, SAS Institute Inc. All rights reserved. WHAT IT LOOKS LIKE… yearpredsucc 2023AB posaccountyearexcessfy_1fy_2fy_3 succB2020$0.00$0 succB2021$0.00$0 succB2022$0.00$0 succB2023$0.00$0 predA2020$0.00$0 predA2021$0.00$0 predA2022$0.00$0 predA2023$0.00$0

34 Copyright © 2014, SAS Institute Inc. All rights reserved. HOW TO FIX…

35 Copyright © 2014, SAS Institute Inc. All rights reserved. LOGIC LAPSE SUMMARY Applying a DATETIME format to a SAS date Not checking for undefined formats Parsing incorrectly Not accounting for case sensitivity Not accounting for leading or trailing blanks Not accounting for hex characters Incorrect handling of endpoints Incorrect sorting (primary/secondary/tertiary) Losing data when converting text strings to SAS dates Not imposing integrity constraints on input parameters

36 Copyright © 2014, SAS Institute Inc. All rights reserved. ACKNOWLEDGMENTS Thanks to the developers whose defects made this presentation possible.

FOR ADDITIONAL INFORMATION, CONTACT: Jenni M. Elion Senior Development Tester ▪ SAS Solutions OnDemand Tel: ▪ 100 SAS Campus Drive ▪ Cary, NC USA