Introduction to Proc SQL Steven First, Systems Seminar Consultants, Madison, WI
|
|
|
- Archibald Clark
- 9 years ago
- Views:
Transcription
1 Paper #HW02 Introduction to Proc SQL Steven First, Systems Seminar Consultants, Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps into a single step. PROC SQL can sort, summarize, subset, join (merge), and concatenate datasets, create new variables, and print the results or create a new table or view all in one step! PROC SQL can be used to retrieve, update, and report on information from SAS data sets or other database products. This paper will concentrate on SQL's syntax and how to access information from existing SAS data sets. Some of the topics covered in this brief introduction include: Write SQL code using various styles of the SELECT statement. Dynamically create new variables on the SELECT statement. Use CASE/WHEN clauses for conditionally processing the data. Joining data from two or more data sets (like a MERGE!). Concatenating query results together. WHY LEARN PROC SQL? PROC SQL can not only retrieve information without having to learn SAS syntax, but it can often do this with fewer and shorter statements than traditional SAS code. Additionally, SQL often uses fewer resources than conventional DATA and PROC steps. Further, the knowledge learned is transferable to other SQL packages. AN EXAMPLE OF PROC SQL SYNTAX Every PROC SQL query must have at least one SELECT statement. The purpose of the SELECT statement is to name the columns that will appear on the report and the order in which they will appear (similar to a VAR statement on PROC PRINT). The FROM clause names the data set from which the information will be extracted (similar to the SET statement). One advantage of SQL is that new variables can be dynamically created on the SELECT statement, which is a feature we do not normally associate with a SAS Procedure: SELECT STATE, SALES, (SALES *.05) AS TAX ; (no output shown for this code) THE SELECT STATEMENT SYNTAX The purpose of the SELECT statement is to describe how the report will look. It consists of the SELECT clause and several sub-clauses. The sub-clauses name the input dataset, select rows meeting certain conditions (subsetting), group (or aggregate) the data, and order (or sort) the data: PROC SQL options; SELECT column(s) FROM table-name view-name WHERE expression GROUP BY column(s) HAVING expression ORDER BY column(s); A SIMPLE PROC SQL An asterisk on the SELECT statement will select all columns from the data set. By default a row will wrap when there is too much information to fit across the page. Column headings will be separated from the data with a line and no observation number will appear: SELECT * ; (see output #1 for results) 1
2 LIMITING INFORMATION ON THE SELECT To specify that only certain variables should appear on the report, the variables are listed and separated by commas on the SELECT statement. The SELECT statement does NOT limit the number of variables read. The NUMBER option will print a column on the report labeled 'ROW' which contains the observation number: PROC SQL NUMBER; SELECT STATE, SALES ; (see output #2 for results) CREATING NEW VARIABLES Variables can be dynamically created in PROC SQL. Dynamically created variables can be given a variable name, label, or neither. If a dynamically created variable is not given a name or a label, it will appear on the report as a column with no column heading. Any of the DATA step functions can be used in an expression to create a new variable except LAG, DIF, and SOUND. Notice the commas separating the columns: SELECT SUBSTR(STORENO,1,3) LABEL='REGION', SALES, (SALES *.05) AS TAX, (SALES *.05) *.01 ; (see output #3 for results) THE CALCULATED OPTION ON THE SELECT Starting with Version 6.07, the CALCULATED component refers to a previously calculated variable so recalculation is not necessary. The CALCULATED component must refer to a variable created within the same SELECT statement: SELECT STATE, (SALES *.05) AS TAX, (SALES *.05) *.01 AS REBATE ; - or - SELECT STATE, (SALES *.05) AS TAX, CALCULATED TAX *.01 AS REBATE ; (see output #4 for results) USING LABELS AND FORMATS SAS-defined or user-defined formats can be used to improve the appearance of the body of a report. LABELs give the ability to define longer column headings: TITLE 'REPORT OF THE U.S. SALES'; FOOTNOTE 'PREPARED BY THE MARKETING DEPT.'; SELECT STATE, SALES FORMAT=DOLLAR10.2 LABEL='AMOUNT OF SALES', (SALES *.05) AS TAX FORMAT=DOLLAR7.2 LABEL='5% TAX' ; (see output #5 for results) THE CASE EXPRESSION ON THE SELECT The CASE Expression allows conditional processing within PROC SQL: SELECT STATE, 2
3 CASE WHEN SALES<=10000 THEN 'LOW' WHEN SALES<=15000 THEN 'AVG' WHEN SALES<=20000 THEN 'HIGH' ELSE 'VERY HIGH' END AS SALESCAT ; (see output #6 for results) The END is required when using the CASE. Coding the WHEN in descending order of probability will improve efficiency because SAS will stop checking the CASE conditions as soon as it finds the first true value. ANOTHER CASE The CASE statement has much of the same functionality as an IF statement. Here is yet another variation on the CASE expression: SELECT STATE, CASE WHEN SALES > AND STORENO IN ('33281','31983') THEN 'CHECKIT' ELSE 'OKAY' END AS SALESCAT ; (see output #7 for results) ADDITIONAL SELECT STATEMENT CLAUSES The GROUP BY clause can be used to summarize or aggregate data. Summary functions (also referred to as aggregate functions) are used on the SELECT statement for each of the analysis variables: SELECT STATE, SUM(SALES) AS TOTSALES GROUP BY STATE; (see output #8 for results) Other summary functions available are the AVG/MEAN, COUNT/FREQ/N, MAX, MIN, NMISS, STD, SUM, and VAR. This capability Is similar to PROC SUMMARY with a CLASS statement. REMERGING Remerging occurs when a summary function is used without a GROUP BY. The result is a grand total shown on every line: SELECT STATE, SUM(SALES) AS TOTSALES ; (see output #9 for results) REMERGING FOR TOTALS Sometimes remerging is good, as in the case when the SELECT statement does not contain any other variables: SELECT SUM(SALES) AS TOTSALES ; (see output #10 for results) CALCULATING PERCENTAGE Remerging can also be used to calculate percentages: 3
4 SELECT STATE, SALES, (SALES/SUM(SALES)) AS PCTSALES FORMAT=PERCENT7.2 ; (see output #11 for results) Check your output carefully when the remerging note appears in your log to determine if the results are what you expect. SORTING THE DATA IN PROC SQL The ORDER BY clause will return the data in sorted order: Much like PROC SORT, if the data is already in sorted order, PROC SQL will print a message in the LOG stating the sorting utility was not used. When sorting on an existing column, PROC SQL and PROC SORT are nearly comparable in terms of efficiency. SQL may be more efficient when you need to sort on a dynamically created variable: SELECT STATE, SALES ORDER BY STATE, SALES DESC; (see output #12 for results) SORT ON NEW COLUMN On the ORDER BY or GROUP BY clauses, columns can be referred to by their name or by their position on the SELECT cause. The option 'ASC' (ascending) on the ORDER BY clause is the default, it does not need to be specified. SELECT SUBSTR(STORENO,1,3) LABEL='REGION', (SALES *.05) AS TAX ORDER BY 1 ASC, TAX DESC; (see output #13 for results) SUBSETTING USING THE WHERE The WHERE statement will process a subset of data rows before they are processed: SELECT * WHERE STATE IN ('OH','IN','IL'); SELECT * WHERE NSTATE IN (10,20,30); SELECT * WHERE STATE IN ('OH','IN','IL') AND SALES > 500; (no output shown for this example) INCORRECT WHERE CLAUSE Be careful of the WHERE clause, it cannot reference a computed variable: SELECT STATE, SALES, (SALES *.05) AS TAX WHERE STATE IN ('OH','IN','IL') 4
5 AND TAX > 10 ; (see output #14 for results) WHERE ON COMPUTED COLUMN To use computed variables on the WHERE clause they must be recomputed: SELECT STATE, SALES, (SALES *.05) AS TAX WHERE STATE IN ('OH','IL','IN') AND (SALES *.05) > 10; (see output #15 for results) SELECTION ON GROUP COLUMN The WHERE clause cannot be used with the GROUP BY: SELECT STATE, STORE, SUM(SALES) AS TOTSALES GROUP BY STATE, STORE WHERE TOTSALES > 500; (see output #16 for results) USE HAVING CLAUSE In order to subset data when grouping is in effect, the HAVING clause must be used: SELECT STATE, STORENO, SUM(SALES) AS TOTSALES GROUP BY STATE, STORENO HAVING SUM(SALES) > 500; (see output #17 for results) HAVING WITHOUT A COMPUTED COLUMN The HAVING clause is needed even if it is not referring to a computed variable: SELECT STATE, SUM(SALES) AS TOTSALES GROUP BY STATE HAVING STATE IN ('IL','WI'); (see output #18 for results) CREATING NEW TABLES OR VIEWS The CREATE statement provides the ability to create a new data set as output in lieu of a report (which is what happens when a SELECT is present without a CREATE statement). The CREATE statement can either build a TABLE (a traditional SAS dataset, like what is built on a SAS DATA statement) or a VIEW (not covered in this paper): CREATE TABLE TESTA AS SELECT STATE, SALES WHERE STATE IN ('IL','OH'); SELECT * FROM TESTA; 5
6 (see output #19 for results) The name given on the create statement can either be temporary or permanent. Only one table or view can be created by a CREATE statement. The second SELECT statement (without a CREATE) is used to generate the report. JOINING DATASETS USING PROC SQL A join is used to combine information from multiple files. One advantage of using PROC SQL to join files is that it does not require sorting the datasets prior to joining as is required with a DATA step merge. A Cartesian Join combines all rows from one file with all rows from another file. This type of join is difficult to perform using traditional SAS code. SELECT * FROM JANSALES, FEBSALES; (see output #20 for results) INNER JOIN A Conventional or Inner Join combines datasets only if an observation is in both datasets. This type of join is similar to a DATA step merge using the IN Data Set Option and IF logic requiring that the observation is on both data sets (IF ONA AND ONB). SELECT U.STORENO, U.STATE, F.SALES AS FEBSALES U, FEBSALES F WHERE U.STORENO=F.STORENO; (see output #21 for results) JOINING THREE OR MORE TABLES An Associative Join combines information from three or more tables. Performing this operation using traditional SAS code would require several PROC SORTs and several DATA step merges. The same result can be achieved with one PROC SQL: SELECT B.FNAME, B.LNAME, CLAIMS, E.STORENO, STATE FROM BENEFITS B, EMPLOYEE E, FEBSALES F WHERE B.FNAME=E.FNAME AND B.LNAME=E.LNAME AND E.STORENO=F.STORENO AND CLAIMS > 1000; (see output #22 for dataset list and results) CONCATENATING QUERY RESULTS Query results can be concatenated with the UNION operator. The UNION operator keeps only unique observations. To keep all observations, the UNION ALL operator can be used. Traditional SAS syntax would require the creation of multiple tables and then either a SET concatenation or a PROC APPEND. Again, the results can be achieved with one PROC SQL: CREATE TABLE YTDSALES AS SELECT TRANCODE, STORENO, SALES FROM JANSALES UNION SELECT TRANCODE, STORENO, SALES *.99 FROM FEBSALES; (no output shown for this example) 6
7 CHANGES IN VERSION 8 AND 9 1. Some PROC SQL views are now updateable. The view must be based on a single DBMS table or SAS data file and must not contain a join, an ORDER BY clause, or a subquery. 2. Whenever possible, PROC SQL passes joins to the DBMS rather than doing the joins itself. This enhances performance. 3. You can now store DBMS connection information in a view with the USING LIBNAME clause. 4. A new option, DQUOTE=ANSI, enables you to use non-sas names in PROC-SQL. 5. A PROC SQL query can now reference up to 32 views or tables. PROC SQL can perform joins on up to 32 tables. 6. PROC SQL can now create and update tables that contain integrity constraints. IN SUMMARY PROC SQL is a powerful data analysis tool. It can perform many of the same operations as found in traditional SAS code, but can often be more efficient because of its dense language structure. PROC SQL can be an effective tool for joining data, particularly when doing associative, or three-way joins. For more information regarding SQL joins, reference the papers noted in the bibliography. TRADEMARK NOTICE SAS and PROC SQL are registered trademarks of the SAS Institute Inc., Cary, NC, USA and other countries. CONTACT INFORMATION Any questions or comments regarding the paper may be directed to: Steve First Systems Seminar Consultants, Inc Yarmouth Greenway Drive Madison, WI Phone: (608) Fax: (608) [email protected] 7
8 OUTPUT #1 (PARTIAL): STATE SALES STORENO COMMENT STORENAM WI SALES WERE SLOW BECAUSE OF COMPETITORS SALE RON'S VALUE RITE STORE WI SALES SLOWER THAN NORMAL BECAUSE OF BAD WEATHER PRICED SMART GROCERS WI AVERAGE SALES ACTIVITY REPORTED VALUE CITY OUTPUT #2 (PARTIAL): ROW STATE SALES WI WI WI OUTPUT #3 (PARTIAL): REGION SALES TAX OUTPUT #4 (PARTIAL): STATE TAX REBATE WI WI WI MI OUTPUT #5 (PARTIAL): REPORT OF THE U.S. SALES AMOUNT OF STATE SALES 5% TAX WI $10, $ WI $9, $ WI $15, $ MI $33, PREPARED BY THE MARKETING DEPT. 8
9 OUTPUT #6 (PARTIAL): STATE SALESCAT WI AVG WI LOW WI HIGH MI VERY HIGH OUTPUT #7 (PARTIAL): STATE SALESCAT WI OKAY WI OKAY WI OKAY MI CHECKIT OUTPUT #8: STATE TOTSALES IL MI WI OUTPUT #9 (PARTIAL): STATE TOTSALES WI WI WI MI OUTPUT #10: TOTSALES OUTPUT #11 (PARTIAL): (log message shown) STATE SALES PCTSALES WI % WI % WI % MI % NOTE: The query requires remerging summary Statistics back with the original data. 9
10 OUTPUT #12 (PARTIAL): STATE SALES IL IL IL IL MI OUTPUT #13 (PARTIAL): REGION TAX OUTPUT #14 (THE RESULTING SAS LOG- PARTIAL): SELECT STATE,SALES, (SALES *.05) AS TAX WHERE STATE IN ('OH','IN','IL') AND TAX > 10; ERROR: THE FOLLOWING COLUMNS WERE NOT FOUND IN THE CONTRIBUTING TABLES: TAX. NOTE: The SAS System stopped processing this step because of errors. OUTPUT #15 (PARTIAL): STATE SALES TAX WI WI WI IL OUTPUT #16 (THE RESULTING SAS LOG- PARTIAL): 167 GROUP BY STATE, STORE 168 WHERE TOTSALES > 500; ERROR : Expecting one of the following: (, **, *, /, +, -,!!,, <, <=, <>, =, >, >=, EQ, GE, GT, LE, LT, NE, ^=, ~=, &, AND,!, OR,, ',', HAVING, ORDER. The statement is being ignored. ERROR : The option or parameter is not recognized. 10
11 OUTPUT #17 (PARTIAL): STATE STORENO TOTSALES IL IL IL IL MI OUTPUT #18: STATE TOTSALES IL WI OUTPUT #19: STATE SALES IL IL IL IL OUTPUT #20(PARTIAL): STATE SALES STORENO NUMEMP STATE SALES STORENO ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ WI IL WI IL WI IL MI IL MI IL IL IL IL IL IL IL IL IL WI IL WI IL WI IL MI IL OUTPUT #21 (PARTIAL): STORENO STATE FEBSALES ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ WI WI WI WI MI MI IL IL
12 OUTPUT #22: EMPLOYEE FEBSALES BENEFITS OBS FNAME LNAME STORENO OBS STATE SALES STORENO OBS FNAME LNAME CLAIMS 1 ANN BECKER MI ANN BECKER CHRIS DOBSON MI CHRIS DOBSON EARL FISHER IL ALLEN PARK ALLEN PARK IL BETTY JOHNSON BETTY JOHNSON KAREN ADAMS FNAME LNAME CLAIMS STORENO STATE ANN BECKER MI ALLEN PARK IL BETTY JOHNSON IL 12
Katie Minten Ronk, Steve First, David Beam Systems Seminar Consultants, Inc., Madison, WI
Paper 191-27 AN INTRODUCTION TO PROC SQL Katie Minten Ronk, Steve First, David Beam Systems Seminar Consultants, Inc., Madison, WI ABSTRACT PROC SQL is a powerful Base SAS 7 Procedure that combines the
Introduction to Proc SQL Katie Minten Ronk, Systems Seminar Consultants, Madison, WI
Paper 268-29 Introduction to Proc SQL Katie Minten Ronk, Systems Seminar Consultants, Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps
Advanced Subqueries In PROC SQL
Advanced Subqueries In PROC SQL PROC SQL; SELECT STATE, AVG(SALES) AS AVGSALES FROM USSALES GROUP BY STATE HAVING AVG(SALES) > (SELECT AVG(SALES) FROM USSALES); QUIT; STATE AVGSALES --------------- IL
AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C. Y. Associates
AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C Y Associates Abstract This tutorial will introduce the SQL (Structured Query Language) procedure through a series of simple examples We will initially
Chapter 1 Overview of the SQL Procedure
Chapter 1 Overview of the SQL Procedure 1.1 Features of PROC SQL...1-3 1.2 Selecting Columns and Rows...1-6 1.3 Presenting and Summarizing Data...1-17 1.4 Joining Tables...1-27 1-2 Chapter 1 Overview of
Performing Queries Using PROC SQL (1)
SAS SQL Contents Performing queries using PROC SQL Performing advanced queries using PROC SQL Combining tables horizontally using PROC SQL Combining tables vertically using PROC SQL 2 Performing Queries
The Query Builder: The Swiss Army Knife of SAS Enterprise Guide
Paper 1557-2014 The Query Builder: The Swiss Army Knife of SAS Enterprise Guide ABSTRACT Jennifer First-Kluge and Steven First, Systems Seminar Consultants, Inc. The SAS Enterprise Guide Query Builder
Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation
Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation Abstract This paper discusses methods of joining SAS data sets. The different methods and the reasons for choosing a particular
Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL)
Copyright 2000-2001, University of Washington Using Multiple Operations Implementing Table Operations Using Structured Query Language (SQL) The implementation of table operations in relational database
Fun with PROC SQL Darryl Putnam, CACI Inc., Stevensville MD
NESUG 2012 Fun with PROC SQL Darryl Putnam, CACI Inc., Stevensville MD ABSTRACT PROC SQL is a powerful yet still overlooked tool within our SAS arsenal. PROC SQL can create tables, sort and summarize data,
Using the SQL Procedure
Using the SQL Procedure Kirk Paul Lafler Software Intelligence Corporation Abstract The SQL procedure follows most of the guidelines established by the American National Standards Institute (ANSI). In
9.1 SAS. SQL Query Window. User s Guide
SAS 9.1 SQL Query Window User s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS 9.1 SQL Query Window User s Guide. Cary, NC: SAS Institute Inc. SAS
Handling Missing Values in the SQL Procedure
Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA ABSTRACT PROC SQL as a powerful database management tool provides
Introduction to SQL and SQL in R. LISA Short Courses Xinran Hu
Introduction to SQL and SQL in R LISA Short Courses Xinran Hu 1 Laboratory for Interdisciplinary Statistical Analysis LISA helps VT researchers benefit from the use of Statistics Collaboration: Visit our
Oracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
Information Systems SQL. Nikolaj Popov
Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria [email protected] Outline SQL Table Creation Populating and Modifying
Introduction to Microsoft Jet SQL
Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of
3.GETTING STARTED WITH ORACLE8i
Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
Five Little Known, But Highly Valuable, PROC SQL Programming Techniques. a presentation by Kirk Paul Lafler
Five Little Known, But Highly Valuable, PROC SQL Programming Techniques a presentation by Kirk Paul Lafler Copyright 1992-2014 by Kirk Paul Lafler and Software Intelligence Corporation. All rights reserved.
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
Outline. SAS-seminar Proc SQL, the pass-through facility. What is SQL? What is a database? What is Proc SQL? What is SQL and what is a database
Outline SAS-seminar Proc SQL, the pass-through facility How to make your data processing someone else s problem What is SQL and what is a database Quick introduction to Proc SQL The pass-through facility
Effective Use of SQL in SAS Programming
INTRODUCTION Effective Use of SQL in SAS Programming Yi Zhao Merck & Co. Inc., Upper Gwynedd, Pennsylvania Structured Query Language (SQL) is a data manipulation tool of which many SAS programmers are
SQL - QUICK GUIDE. Allows users to access data in relational database management systems.
http://www.tutorialspoint.com/sql/sql-quick-guide.htm SQL - QUICK GUIDE Copyright tutorialspoint.com What is SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
Financial Data Access with SQL, Excel & VBA
Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Abstract This paper introduces SAS users with at least a basic understanding of SAS data
Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification
Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries
2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com
Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally
Chapter 2 The Data Table. Chapter Table of Contents
Chapter 2 The Data Table Chapter Table of Contents Introduction... 21 Bringing in Data... 22 OpeningLocalFiles... 22 OpeningSASFiles... 27 UsingtheQueryWindow... 28 Modifying Tables... 31 Viewing and Editing
Welcome to the topic on queries in SAP Business One.
Welcome to the topic on queries in SAP Business One. 1 In this topic, you will learn to create SQL queries using the SAP Business One query tools Query Wizard and Query Generator. You will also see how
Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
SQL. Short introduction
SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.
Quick Start to Data Analysis with SAS Table of Contents. Chapter 1 Introduction 1. Chapter 2 SAS Programming Concepts 7
Chapter 1 Introduction 1 SAS: The Complete Research Tool 1 Objectives 2 A Note About Syntax and Examples 2 Syntax 2 Examples 3 Organization 4 Chapter by Chapter 4 What This Book Is Not 5 Chapter 2 SAS
SQL SELECT Query: Intermediate
SQL SELECT Query: Intermediate IT 4153 Advanced Database J.G. Zheng Spring 2012 Overview SQL Select Expression Alias revisit Aggregate functions - complete Table join - complete Sub-query in where Limiting
Relational Database: Additional Operations on Relations; SQL
Relational Database: Additional Operations on Relations; SQL Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Overview The course packet
Salary. Cumulative Frequency
HW01 Answering the Right Question with the Right PROC Carrie Mariner, Afton-Royal Training & Consulting, Richmond, VA ABSTRACT When your boss comes to you and says "I need this report by tomorrow!" do
COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries
COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions
Structured Query Language (SQL)
Objectives of SQL Structured Query Language (SQL) o Ideally, database language should allow user to: create the database and relation structures; perform insertion, modification, deletion of data from
Unit 10: Microsoft Access Queries
Microsoft Access Queries Unit 10: Microsoft Access Queries Introduction Queries are a fundamental means of accessing and displaying data from tables. Queries used to view, update, and analyze data in different
DBMS / Business Intelligence, SQL Server
DBMS / Business Intelligence, SQL Server Orsys, with 30 years of experience, is providing high quality, independant State of the Art seminars and hands-on courses corresponding to the needs of IT professionals.
CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases
3 CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases About This Document 3 Methods for Accessing Relational Database Data 4 Selecting a SAS/ACCESS Method 4 Methods for Accessing DBMS Tables
Subsetting Observations from Large SAS Data Sets
Subsetting Observations from Large SAS Data Sets Christopher J. Bost, MDRC, New York, NY ABSTRACT This paper reviews four techniques to subset observations from large SAS data sets: MERGE, PROC SQL, user-defined
SAS Programming Tips, Tricks, and Techniques
SAS Programming Tips, Tricks, and Techniques A presentation by Kirk Paul Lafler Copyright 2001-2012 by Kirk Paul Lafler, Software Intelligence Corporation All rights reserved. SAS is the registered trademark
Microsoft Access 3: Understanding and Creating Queries
Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex
Database Administration with MySQL
Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational
EXST SAS Lab Lab #4: Data input and dataset modifications
EXST SAS Lab Lab #4: Data input and dataset modifications Objectives 1. Import an EXCEL dataset. 2. Infile an external dataset (CSV file) 3. Concatenate two datasets into one 4. The PLOT statement will
CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY
CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY 2.1 Introduction In this chapter, I am going to introduce Database Management Systems (DBMS) and the Structured Query Language (SQL), its syntax and usage.
Relational Databases
Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute
Lecture 25: Database Notes
Lecture 25: Database Notes 36-350, Fall 2014 12 November 2014 The examples here use http://www.stat.cmu.edu/~cshalizi/statcomp/ 14/lectures/23/baseball.db, which is derived from Lahman s baseball database
Access Queries (Office 2003)
Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy
Introduction to SQL for Data Scientists
Introduction to SQL for Data Scientists Ben O. Smith College of Business Administration University of Nebraska at Omaha Learning Objectives By the end of this document you will learn: 1. How to perform
From The Little SAS Book, Fifth Edition. Full book available for purchase here.
From The Little SAS Book, Fifth Edition. Full book available for purchase here. Acknowledgments ix Introducing SAS Software About This Book xi What s New xiv x Chapter 1 Getting Started Using SAS Software
SQL Basics. Introduction to Standard Query Language
SQL Basics Introduction to Standard Query Language SQL What Is It? Structured Query Language Common Language For Variety of Databases ANSI Standard BUT. Two Types of SQL DML Data Manipulation Language
Paper TU_09. Proc SQL Tips and Techniques - How to get the most out of your queries
Paper TU_09 Proc SQL Tips and Techniques - How to get the most out of your queries Kevin McGowan, Constella Group, Durham, NC Brian Spruell, Constella Group, Durham, NC Abstract: Proc SQL is a powerful
Foundations & Fundamentals. A PROC SQL Primer. Matt Taylor, Carolina Analytical Consulting, LLC, Charlotte, NC
A PROC SQL Primer Matt Taylor, Carolina Analytical Consulting, LLC, Charlotte, NC ABSTRACT Most SAS programmers utilize the power of the DATA step to manipulate their datasets. However, unless they pull
Database Query 1: SQL Basics
Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic
David M. Kroenke and David J. Auer Database Processing: Fundamentals, Design and Implementation
David M. Kroenke and David J. Auer Database Processing: Fundamentals, Design and Implementation Chapter Two: Introduction to Structured Query Language 2-1 Chapter Objectives To understand the use of extracted
Programming with SQL
Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using
Oracle Database 12c: Introduction to SQL Ed 1.1
Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,
Week 4 & 5: SQL. SQL as a Query Language
Week 4 & 5: SQL The SQL Query Language Select Statements Joins, Aggregate and Nested Queries Insertions, Deletions and Updates Assertions, Views, Triggers and Access Control SQL 1 SQL as a Query Language
Managing very large EXCEL files using the XLS engine John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc., Ridgefield, CT
Paper AD01 Managing very large EXCEL files using the XLS engine John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc., Ridgefield, CT ABSTRACT The use of EXCEL spreadsheets is very common in SAS applications,
Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL
Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality
SAS Views The Best of Both Worlds
Paper 026-2010 SAS Views The Best of Both Worlds As seasoned SAS programmers, we have written and reviewed many SAS programs in our careers. What I have noticed is that more often than not, people who
Alternatives to Merging SAS Data Sets But Be Careful
lternatives to Merging SS Data Sets ut e Careful Michael J. Wieczkowski, IMS HELTH, Plymouth Meeting, P bstract The MERGE statement in the SS programming language is a very useful tool in combining or
Database Applications Microsoft Access
Database Applications Microsoft Access Lesson 4 Working with Queries Difference Between Queries and Filters Filters are temporary Filters are placed on data in a single table Queries are saved as individual
Your Database Can Do SAS Too!
Paper 2004-2015 Your Database Can Do SAS Too! Harry Droogendyk, Stratia Consulting Inc. ABSTRACT How often have you pulled oodles of data out of the corporate data warehouse down into SAS for additional
Aggregating Data Using Group Functions
Aggregating Data Using Group Functions Objectives Capter 5 After completing this lesson, you should be able to do the following: Identify the available group functions Describe the use of group functions
Microsoft' Excel & Access Integration
Microsoft' Excel & Access Integration with Office 2007 Michael Alexander and Geoffrey Clark J1807 ; pwiueyb Wiley Publishing, Inc. Contents About the Authors Acknowledgments Introduction Part I: Basic
Using SQL Queries in Crystal Reports
PPENDIX Using SQL Queries in Crystal Reports In this appendix Review of SQL Commands PDF 924 n Introduction to SQL PDF 924 PDF 924 ppendix Using SQL Queries in Crystal Reports The SQL Commands feature
Counting the Ways to Count in SAS. Imelda C. Go, South Carolina Department of Education, Columbia, SC
Paper CC 14 Counting the Ways to Count in SAS Imelda C. Go, South Carolina Department of Education, Columbia, SC ABSTRACT This paper first takes the reader through a progression of ways to count in SAS.
C H A P T E R 1 Introducing Data Relationships, Techniques for Data Manipulation, and Access Methods
C H A P T E R 1 Introducing Data Relationships, Techniques for Data Manipulation, and Access Methods Overview 1 Determining Data Relationships 1 Understanding the Methods for Combining SAS Data Sets 3
Your Database Can Do SAS Too!
SESUG 2014 Paper AD-57 Your Database Can Do SAS Too! Harry Droogendyk, Stratia Consulting Inc., Lynden, ON ABSTRACT How often have you pulled oodles of data out of the corporate data warehouse down into
More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan
More on SQL Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan SELECT A1, A2,, Am FROM R1, R2,, Rn WHERE C1, C2,, Ck Interpreting a Query
Oracle Database 11g SQL
AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries
Inquiry Formulas. student guide
Inquiry Formulas student guide NOTICE This documentation and the Axium software programs may only be used in accordance with the accompanying Ajera License Agreement. You may not use, copy, modify, or
Programming Tricks For Reducing Storage And Work Space Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA.
Paper 23-27 Programming Tricks For Reducing Storage And Work Space Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA. ABSTRACT Have you ever had trouble getting a SAS job to complete, although
WRITING EFFICIENT SQL. By Selene Bainum
WRITING EFFICIENT SQL By Selene Bainum About Me Extensive SQL & database development since 1995 ColdFusion Developer since 1996 Author & Speaker Co-Founder RiteTech LLC IT & Web Company in Washington,
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
Introduction to SAS Mike Zdeb (402-6479, [email protected]) #122
Mike Zdeb (402-6479, [email protected]) #121 (11) COMBINING SAS DATA SETS There are a number of ways to combine SAS data sets: # concatenate - stack data sets (place one after another) # interleave - stack
SQL Server 2008 Core Skills. Gary Young 2011
SQL Server 2008 Core Skills Gary Young 2011 Confucius I hear and I forget I see and I remember I do and I understand Core Skills Syllabus Theory of relational databases SQL Server tools Getting help Data
Netezza SQL Class Outline
Netezza SQL Class Outline CoffingDW education has been customized for every customer for the past 20 years. Our classes can be taught either on site or remotely via the internet. Education Contact: John
Using AND in a Query: Step 1: Open Query Design
Using AND in a Query: Step 1: Open Query Design From the Database window, choose Query on the Objects bar. The list of saved queries is displayed, as shown in this figure. Click the Design button. The
To increase performaces SQL has been extended in order to have some new operations avaiable. They are:
OLAP To increase performaces SQL has been extended in order to have some new operations avaiable. They are:. roll up: aggregates different events to reduce details used to describe them (looking at higher
Fig. 1 Suitable data for a Crosstab Query.
Crosstab Queries A Crosstab Query is a special kind of query that summarizes data by plotting one field against one or more other fields. Crosstab Queries can handle large amounts of data with ease and
MOC 20461C: Querying Microsoft SQL Server. Course Overview
MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server
Oracle Database 10g: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.
Ad Hoc Advanced Table of Contents
Ad Hoc Advanced Table of Contents Functions... 1 Adding a Function to the Adhoc Query:... 1 Constant... 2 Coalesce... 4 Concatenate... 6 Add/Subtract... 7 Logical Expressions... 8 Creating a Logical Expression:...
SUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6
SUBQUERIES AND VIEWS CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6 String Comparisons and GROUP BY 2! Last time, introduced many advanced features of SQL, including GROUP BY! Recall:
ICAB4136B Use structured query language to create database structures and manipulate data
ICAB4136B Use structured query language to create database structures and manipulate data Release: 1 ICAB4136B Use structured query language to create database structures and manipulate data Modification
The Basics of Querying in FoxPro with SQL SELECT. (Lesson I Single Table Queries)
The Basics of Querying in FoxPro with SQL SELECT (Lesson I Single Table Queries) The idea behind a query is to take a large database, possibly consisting of more than one table, and producing a result
SQL Nested & Complex Queries. CS 377: Database Systems
SQL Nested & Complex Queries CS 377: Database Systems Recap: Basic SQL Retrieval Query A SQL query can consist of several clauses, but only SELECT and FROM are mandatory SELECT FROM
SQL Programming. Student Workbook
SQL Programming Student Workbook 2 SQL Programming SQL Programming Published by itcourseware, Inc., 7245 South Havana Street, Suite 100, Englewood, CO 80112 Contributing Authors: Denise Geller, Rob Roselius,
Creating QBE Queries in Microsoft SQL Server
Creating QBE Queries in Microsoft SQL Server When you ask SQL Server or any other DBMS (including Access) a question about the data in a database, the question is called a query. A query is simply a question
Using SAS With a SQL Server Database. M. Rita Thissen, Yan Chen Tang, Elizabeth Heath RTI International, RTP, NC
Using SAS With a SQL Server Database M. Rita Thissen, Yan Chen Tang, Elizabeth Heath RTI International, RTP, NC ABSTRACT Many operations now store data in relational databases. You may want to use SAS
Oracle 10g PL/SQL Training
Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural
Oracle Database: Introduction to SQL
Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.
