Setting SQL Procedure Options

Slides:



Advertisements
Similar presentations
Chapter 4 Joining Multiple Tables
Advertisements

Chapter Eight: Database Redesign Database Processing: Fundamentals, Design, and Implementation.
Managing Processing Using PROC SQL Chapter 8 1 Imelda Go, John Grego, Jennifer Lasecki, 2011.
Performing Queries Using PROC SQL Chapter 1 1 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
11 Chapter 3: Displaying Query Results 3.1 Presenting Data 3.2 Summarizing Data.
Introduction to Oracle9i: SQL1 Basic SQL SELECT Statements.
SQL Basics Based on the relational algebra we just learned. Nonprocedural language – what to be done not how Simple, powerful language Used for both data.
1 Internal Table / DB Alternatives Analysis of Various Table Lookup Approaches.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
11 Chapter 2: Basic Queries 2.1: Overview of the SQL Procedure 2.2: Specifying Columns 2.3: Specifying Rows.
Chapter 8: Additional PROC SQL Features
SQL/lesson 2/Slide 1 of 45 Retrieving Result Sets Objectives In this lesson, you will learn to: * Use wildcards * Use the IS NULL and IS NOT NULL keywords.
Creating and Managing Indexes Using Proc SQL Chapter 6 1.
11 Chapter 7: Creating Tables and Views 7.1 Creating Views with the SQL Procedure 7.2 Creating Tables with the SQL Procedure (Self-Study) 7.3 Integrity.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
Chapter 4Introduction to Oracle9i: SQL1 Chapter 4 Joining Multiple Tables.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
1 DBS201: More on SQL Lecture 3. 2 Agenda How to use SQL to update table definitions How to update data in a table How to join tables together.
Performing Advanced Queries Using PROC SQL Chapter 2 1.
SQL Unit Test Editor WinForm App T-SQL Script Dom Assemblies SQL Unit Test Framework Definition files for customization T-SQL from App SQL Profiler Trace.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
13 Copyright © 2004, Oracle. All rights reserved. Migrating SQL Statements.
IFS180 Intro. to Data Management Chapter 10 - Unions.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Session 1 Retrieving Data From a Single Table
Presentation 4 Creating Databases Part III (Creating Reports)
Chapter 10: Accessing Relational Databases (Self-Study)
SQL Relational Database Project
Applied Business Forecasting and Regression Analysis
Connect to SQL Server and run select statements
Chapter 6: Set Operators
Access Chapter 2 Querying a Database.
© 2016, Mike Murach & Associates, Inc.
Basic select statement
02 | Advanced SELECT Statements
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Querying a Database Using the Select Query Window
Views, Stored Procedures, Functions, and Triggers
Using Window Ranking, Offset, and Aggregate Functions
PROC SQL, Overview.
Creating Macro Variables in SQL (Review)
Writing Basic SQL SELECT Statements
Correlated Subqueries
Advanced PL/SQL Programing
CIS16 Application Programming with Visual Basic
Integrity Constraints
Displaying Queries 2 Display a query’s results in a specified order.
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Outer Joins Inner joins returned only matching rows. When you join tables, you might want to include nonmatching rows as well as matching rows.
Chapter 4 Summary Query.
Grouping Summary Results
Inner Joins.
Program Testing and Performance
Dictionary Tables and Views, obtain information about SAS files
SQL Subquery.
Summarizing Data with Summary Functions
Writing Basic SQL SELECT Statements
Chapter 2 Views.
5 The EXCEPT Operator Unique rows from the first result set that are not found in the second result set are selected.
The INTERSECT Operator
Information Management
Creating Tables Create a new table by defining the column structure.
3 Views.
Subqueries.
SQL set operators and modifiers.
UNION Operator keywords Displays all rows from both the tables
‘ORDER BY’ Order by clause allows sorting of query results by one or more columns. Sorting can be done in ascending or descending. Default order is ascending.
Database SQL.
Presentation transcript:

Setting SQL Procedure Options 4 Setting SQL Procedure Options

Controlling Processing PROC SQL options give you finer control over your SQL processes: Syntax checking without executing your code Expanding SQL statements to their fully-qualified values Restricting the number of rows processed Providing system utilization statistics for query tuning

Controlling Processing, Selected options Effect INOBS=n sets a limit of n rows from each source table that contributes to a query. OUTOBS=n restricts the number of rows that a query outputs (displays or writes to a table). NOSTIMER|STIMER controls whether or not PROC SQL writes resource utilization statistics to the SAS log. continued...

Controlling Processing, Selected options Effect PRINT|NOPRINT controls whether the results of a SELECT statement are displayed in the OUTPUT window. NONUMBER|NUMBER controls whether the row number is displayed as the first column in query output. NODOUBLE|DOUBLE controls whether the report is double-spaced. continued...

Use the RESET statement to add or change PROC SQL options without re-invoking the procedure RESET option(s);

Controlling Processing, Read ten rows from orion.Price_List proc sql inobs=10; title "orion.Price_List - INOBS=10"; select Product_ID, Unit_Cost_Price format=comma8.2, Unit_Sales_Price format=comma8.2, Unit_Sales_Price-Unit_Cost_Price as Margin format=comma8.2 from orion.Price_List ; quit; title;

Controlling Processing Controlling Processing. Join all rows, but limit output to the 10 most profitable customers proc sql outobs=10; title "10 Most Profitable Customers"; select Customer_ID, sum(Unit_Sales_Price-Unit_Cost_Price) as Profit_2007 format=comma8.2 from orion.Price_List as p, orion.Order_Fact as o where p.Product_ID=o.Product_id and year(Order_date) =2007 group by Customer_ID order by Profit_2007 desc; quit; title;

proc sql number outobs=10; title "Top 10 Employee's 2007 Charitable Donations"; select Employee_Name, Sum(Qtr1,Qtr2, Qtr3,Qtr4) as Donation_Total from orion.Employee_Addresses as a, orion.Employee_donations as d where a.Employee_ID=d.Employee_ID order by Donation_Total desc, Employee_Name ; reset nonumber outobs=9; title "Top 9 Employee's 2007 Charitable Donations"; quit; title;