An SQL Tutorial Some Random Tips
|
|
- Rodger Hardy
- 6 years ago
- Views:
Transcription
1 An SQL Tutorial Some Random Tips Presented by Jens Dahl Mikkelsen SAS Institute A/S Author: Paul Kent SAS Institute Inc, Cary, NC.
2 Short Stories Towards a Better UNION Outer Joins. More than two too. Logical Expressions Case Free SoRtiNg Data about Data
3 A Better UNION?
4 A Better UNION? Can SQL do this? DATA A; SET B C; RUN;
5 A Better UNION? Can SQL do this? sure Create table A as select * from B union select * from C;
6 A Better UNION? not quite! SQL Set Operators have strict mathematical semantics UNION is formed on a column by column basis not matched by name UNION requires no duplicate rows in result this is an expensive operation
7 A Better UNION? SQL can do this... Create table A as select * from B union ALL CORRESPONDING select * from C;
8 A Better UNION? SQL CORRESPONDING avoids the SORT QUERY is still interpreted DATASTEP Doesn t need sort to begin with Program is compiled into Native Machine Code Which Means...
9 A Better UNION? DATA STEP : 1 SQL : 0 huh? isn t this an SQL talk?
10 <not> A Better UNION? Choose your battles wisely. Do not abandon those DATA STEP skills. Might still choose SQL if: UNION is part of a larger query You expect to port the program to a NON SAS environment Performance is not your only Metric
11 Outer Joins More than Two Too
12 Outer Join vs. inner join Data A Data B
13 Outer Join vs. inner join Inner Join select * from a, b where a.key = b.key;
14 Outer Join vs. inner join Left Join select * from a left join b on a.key = b.key;
15 Outer Join vs. inner join Full Join select * from a full join b on a.key = b.key;
16 Outer Joins Most People get their SQL joins *wrong* Non Matched records are dropped Information is lost from reports Duplicate Matches seems to double up Totals are unpredictable
17 Outer Joins Consider these Example Datasets PEOPLE PAYROLL INVESTments All linked by a common PERSON
18 Outer Joins select * from people, payroll, invest where peo.person = pay.person and peo.person = inv.person ;
19 Outer Joins This is usually *wrong* Even if all people are recorded in PEOPLE Some may not get paid Some may not have investments SQL default is to drop records with no match Where clause is not true. This combination of rows is not considered interesting
20 Outer Joins select * from people left join payroll on peo.person = pay.person left join invest on peo.person = inv.person ;
21 Outer Joins Better... This query retains people who are not paid not invested SQL provides missing values
22 Outer Joins {LEFT RIGHT FULL} JOIN is SQL syntax that supplements the, used in a FROM Clause. ON {expression} is used instead of a WHERE clause May still have records in the result set for which the ON Clause is not TRUE
23 Have we got it right yet? Select * has problems Includes the join-key person three times people.person payroll.person invest.person How to choose the correct one?
24 Outer Joins select people.*, pay.var1,pay.var2,... inv.var1,inv.var2,... from...
25 Outer Joins Are Your Data perfect? This example assumed: People is a complete set No payroll records exist without corresponding people record No investment records exist without corresponding people record
26 Outer Joins You may know the data are perfect RDBMS integrity constraints Application controls Your Boss told you so But what if it aint so?
27 Outer Joins select COALESCE(peo.person, pay.person, inv.person) as person, peo,var1,peo.var2,... pay.var1,pay.var2,... inv.var1,inv.var2,... from...
28 Outer Joins COALESCE returns its first non-missing argument correctly selects the person key even if the corresponding record is not from the people dataset. Is it correct yet? what if we have a payroll record and an investment record for PAUL, but no people record?
29 Outer Joins From Clause needs fixing too. Left Join is only appropriate in situations where you are 100% confident in the master detail relationship. Full Join can handle the uncertainty of data coming from either table and not the other Full Joins much harder to optimise. Indexes are not useful.
30 Outer Joins from peo full join pay on peo.person = pay.person full join inv on peo.person = inv.person ;
31 Is it correct yet? No What about PAUL who has a payroll record as well as an investment record, but no people record...
32 Outer Joins from peo full join pay on peo.person = pay.person full join inv on peo.person = inv.person ;
33 Outer Joins select COALESCE(peo.person, pay.person, inv.person) as person, peo,var1,peo.var2,... pay.var1,pay.var2,... inv.var1,inv.var2,... from...
34 from peo full join pay on peo.person = pay.person full join inv on COALESCE( peo.person, pay.person) = inv.person ;
35 Outer Joins - SQL 3 select * from people full natural join payroll on person full natural join invest on person;
36 Outer Joins - SQL 3 Fixes all these problems Choosing the key once only on the select clause Coalescing the key properly in the select clause in the on clause
37 Logical Expressions This is only ONE s and ZERO s
38 Logical Expressions Boolean Expressions in SAS *must* evaluate to one of {0,1} You may be able to exploit this: to construct a score for a matching scheme to tally the number of records for which the expression was true
39 Logical Expressions as Join Criteria A Match is a Catch if n or more of these conditions are true Age is within one year of matching First Name matches Last Name matches Initial matches
40 Logical Expressions as Join Criteria select * from A,B where (abs( a.dob - b.dob) < 365) +(a.lastname = b.lastname) +(a.initial = b.initial) +(a.fname = b.fname) >= 2;
41 Logical Expressions as Join Criteria Careful! Make up internal Cartesian Products. Very expensive to evaluate each possible combination of rows from contributing tables
42 Logical Expressions as Counters Exploit the identity that: the SUM of a logical expression is equivalent to the number of rows for which that expression was true. False contributes 0 to the sum. True contributes 1.
43 Logical Expressions as Counters data pets; input person $ cats cards; paul 5 1 linda 0 2 chris 0 2 pat 0 0 kelsey 1 0 thais 0 4 run;
44 Logical Expressions as Counters select person, cats > 0 as cat_own, cats > 2 as cat_love, dogs > 0 as dog_own, dogs > 2 as dog_love from pets ;
45 Logical Expressions as Counters PERSON CAT_OWN CAT_LOVE DOG_OWN DOG_LOVE ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ ƒƒƒƒƒƒƒƒ paul linda chris pat kelsey thais
46 Logical Expressions as Counters select sum(cats > 0) as cat_own, sum(cats > 2) as cat_love, sum(dogs > 0) as dog_own, sum(dogs > 2) as dog_love from pets ;
47 Logical Expressions as Counters CAT_OWN CAT_LOVE DOG_OWN DOG_LOVE ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
48 Logical Expressions as Counters Useful? Perhaps..
49 Case Free Sorting
50 Case Free Sorting Tech Support gets requests for SORT while ignoring case SORT by formatted values SORT a special number to the beginning end
51 Case Free Sorting PROC SQL allows: An expression most anywhere you could have a variable. A Subquery most anywhere you could have an expression This is ANSI SQL2, but some RDBMS do not implement it yet.
52 Case Free Sorting ORDER BY upcase(name) ORDER BY put(variable, format.) ORDER BY CASE WHEN ACCOUNT = 999 THEN. ELSE ACCOUNT END
53 Data about Data How to use DICTIONARY.TABLES to write programs that respond to the contents of libraries dynamically Suppose you have a SAS library with airline data you want to display column info for tables having the string flight in the member label you want listings of those tables.
54 Data about Data Get a list of available tables from DICTIONARY.TABLES Get column info from DICTIONARY.COLUMNS Use some sneaky macro and SQL tricks!
55 Data about Data Get a list of available tables reset noprint; select quote(memname) into :members seperated by ',' from dictionary.tables where libname='airline' and upcase(memlabel) contains FLIGHT ;
56 Data about Data Get the column information reset print flow= 15 20; select memname, name, label, type, length, format, idxusage from dictionary.columns where libname = 'AIRLINE' and memname in(&members);
57 Data about Data Column Member Column Column Column Index Name Name Column Label Type Length Column Format Type ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ ƒƒƒƒƒƒƒƒƒƒ DELAY FLIGHT Flight number char 3 COMPOSITE DELAY DATE Departure date num 8 DATE7. COMPOSITE DELAY DELAY Delay in minutes num 8 5. FLINFO FLIGHT Flight Number char 3 $3. SIMPLE FLINFO ORIG Origin char 3 $3. FLINFO DEST Destination char 3 $3. FLINFO MILES Distance in num 8 5. Nautic Miles MARCH FLIGHT Flight number char 3 $3. COMPOSITE MARCH DATE Departure date num 8 DATE7. COMPOSITE MARCH DEPART Departure (local num 8 TIME8. time) MARCH MAIL Weight of mail (kg) num 8 5. MARCH FREIGHT Weight of freight num 8 5. (kg) MARCH BOARDED No. of boarded num 8 5. passengers MARCH TRANSFER No. of transfer num 8 5. passengers MARCH NONREV No. of non-revenue num 8 5. pass. MARCH DEPLANE No. of disembarked num 8 5. pass. MARCH CAPACITY Max. no of pass. num 8 5. in plane SCHEDULE FLIGHT Flight number char 3 $3. COMPOSITE SCHEDULE DATE Date num 8 DATE7. COMPOSITE SCHEDULE IDNUM Id of crew member char 4 $4. COMPOSITE
58 Data about Data Get the available table names into macro variables reset noprint; select memname into :mem1 thru :mem99 from dictionary.tables where libname='airline' and upcase(memlabel) contains 'FLIGHT' ; %let n_mems = &sqlobs;
59 Data about Data Make listings of those tables (first 20 obs.) %macro prt_mems; reset print outobs=20 number; %do i = 1 %to &n_mems; title " Listing of first 20 rows of AIRLINE.&&&mem&i"; select * from airline.&&&mem&i ; %end; title; %mend; %prt_mems;
60 Data about Data Partial listing Listing of first 20 rows of AIRLINE.DELAY Delay Flight Departure in Row number date minutes ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR MAR94 13
61 Thats All Folks! SAS and SAS/ACCESS are registered trademarks of SAS Institute Inc., Cary, NC, USA. Other brand names are trademarks or registered trademarks of their respective holders.
This is usually wrong. It loses information for people that have either no payroll record, or no investment record - An outer ioin is called for.
An Sal Tutorial - Some Random Tips Paul Kent, SAS Institute Inc.
More informationOverview of Data Management Tasks (command file=datamgt.sas)
Overview of Data Management Tasks (command file=datamgt.sas) Create the March data set: To create the March data set, you can read it from the MARCH.DAT raw data file, using a data step, as shown below.
More informationINTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER
INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER THE SQL PROCEDURE The SQL procedure: enables the use of SQL in SAS is part of Base SAS software follows American National Standards Institute (ANSI)
More informationGet Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI
Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI ABSTRACT PROC SQL is the SAS System s implementation of Structured Query Language (SQL). PROC SQL can be used to retrieve or combine/merge
More informationStat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71
Stat 342 - Wk 3 What is SQL Proc SQL 'Select' command and 'from' clause 'group by' clause 'order by' clause 'where' clause 'create table' command 'inner join' (as time permits) Stat 342 Notes. Week 3,
More informationTales from the Help Desk 6: Solutions to Common SAS Tasks
SESUG 2015 ABSTRACT Paper BB-72 Tales from the Help Desk 6: Solutions to Common SAS Tasks Bruce Gilsen, Federal Reserve Board, Washington, DC In 30 years as a SAS consultant at the Federal Reserve Board,
More informationPROC SQL vs. DATA Step Processing. T Winand, Customer Success Technical Team
PROC SQL vs. DATA Step Processing T Winand, Customer Success Technical Team Copyright 2012, SAS Institute Inc. All rights reserved. Agenda PROC SQL VS. DATA STEP PROCESSING Comparison of DATA Step and
More informationDavid Ghan SAS Education
David Ghan SAS Education 416 307-4515 David.ghan@sas.com Using SQL in SAS Victoria Area SAS User Group February 12, 2004 1. What is SQL? 2. Coding an SQL Query 3. Advanced Examples a. Creating macro variables
More informationcapabilities and their overheads are therefore different.
Applications Development 3 Access DB2 Tables Using Keylist Extraction Berwick Chan, Kaiser Permanente, Oakland, Calif Raymond Wan, Raymond Wan Associate Inc., Oakland, Calif Introduction The performance
More informationSample Questions. SAS Advanced Programming for SAS 9. Question 1. Question 2
Sample Questions The following sample questions are not inclusive and do not necessarily represent all of the types of questions that comprise the exams. The questions are not designed to assess an individual's
More informationUncommon Techniques for Common Variables
Paper 11863-2016 Uncommon Techniques for Common Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT If a variable occurs in more than one data set being merged, the last value (from the variable
More informationContents of SAS Programming Techniques
Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal
More informationSame Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI
Paper BB-02-2013 Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI ABSTRACT When dealing with data from multiple or unstructured data sources,
More informationDictionary.coumns is your friend while appending or moving data
ABSTRACT SESUG Paper CC-41-2017 Dictionary.coumns is your friend while appending or moving data Kiran Venna, Dataspace Inc. Dictionary.columns is a dictionary table, which gives metadata information of
More informationImplementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language
Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations Show Only certain columns and rows from the join of Table A with Table B The implementation of table operations
More informationWhy choose between SAS Data Step and PROC SQL when you can have both?
Paper QT-09 Why choose between SAS Data Step and PROC SQL when you can have both? Charu Shankar, SAS Canada ABSTRACT As a SAS coder, you've often wondered what the SQL buzz is about. Or vice versa you
More informationCourse Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:
Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: 20762C Developing SQL 2016 Databases Module 1: An Introduction to Database Development Introduction to the
More informationSQL Metadata Applications: I Hate Typing
SQL Metadata Applications: I Hate Typing Hannah Fresques, MDRC, New York, NY ABSTRACT This paper covers basics of metadata in SQL and provides useful applications, including: finding variables on one or
More informationWhat is SQL? Designed to retrieve data from relational databases, as well as to build and administer those databases.
SQL Programming Tips & Techniques Michael Mina March 26, 2008 What is SQL? SQL stands for Structured Query Language. Designed to retrieve data from relational databases, as well as to build and administer
More informationT-SQL Training: T-SQL for SQL Server for Developers
Duration: 3 days T-SQL Training Overview T-SQL for SQL Server for Developers training teaches developers all the Transact-SQL skills they need to develop queries and views, and manipulate data in a SQL
More informationPosters. Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA. Paper
Paper 223-25 Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA ABSTRACT As part of its effort to insure that SAS Software is useful to its users, SAS Institute
More informationSAS Certification Handout #10: Adv. Prog. Ch. 5-8
SAS Certification Handout #10: Adv. Prog. Ch. 5-8 /************ Ch. 5 ******************* /* First, make example data -- same as Handout #9 libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes'; /* In
More informationKnow Thy Data : Techniques for Data Exploration
Know Thy Data : Techniques for Data Exploration Montreal SAS Users Group Wednesday, 29 May 2018 13:50-14:30 PM Andrew T. Kuligowski, Charu Shankar AGENDA Part 1- Easy Ways to know your data Part 2 - Powerful
More informationDatabase Systems: Design, Implementation, and Management Tenth Edition. Chapter 8 Advanced SQL
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 8 Advanced SQL Objectives In this chapter, you will learn: How to use the advanced SQL JOIN operator syntax About the different
More informationUsing the SQL Editor. Overview CHAPTER 11
205 CHAPTER 11 Using the SQL Editor Overview 205 Opening the SQL Editor Window 206 Entering SQL Statements Directly 206 Entering an SQL Query 206 Entering Non-SELECT SQL Code 207 Creating Template SQL
More informationUnit Assessment Guide
Unit Assessment Guide Unit Details Unit code Unit name Unit purpose/application ICTWEB425 Apply structured query language to extract and manipulate data This unit describes the skills and knowledge required
More informationHypothesis Testing: An SQL Analogy
Hypothesis Testing: An SQL Analogy Leroy Bracken, Boulder Creek, CA Paul D Sherman, San Jose, CA ABSTRACT This paper is all about missing data. Do you ever know something about someone but don't know who
More informationHow to Create Data-Driven Lists
Paper 9540-2016 How to Create Data-Driven Lists Kate Burnett-Isaacs, Statistics Canada ABSTRACT As SAS programmers we often want our code or program logic to be driven by the data at hand, rather than
More informationDatabase Systems: Design, Implementation, and Management Tenth Edition. Chapter 8 Advanced SQL
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 8 Advanced SQL SQL Join Operators Join operation merges rows from two tables and returns the rows with one of the following:
More informationSAS File Management. Improving Performance CHAPTER 37
519 CHAPTER 37 SAS File Management Improving Performance 519 Moving SAS Files Between Operating Environments 520 Converting SAS Files 520 Repairing Damaged Files 520 Recovering SAS Data Files 521 Recovering
More informationSQL Data Querying and Views
Course A7B36DBS: Database Systems Lecture 04: SQL Data Querying and Views Martin Svoboda Faculty of Electrical Engineering, Czech Technical University in Prague Outline SQL Data manipulation SELECT queries
More informationMOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL
MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL ABSTRACT: Have you ever been faced with this scenario? It s your first day on the
More informationIdentifying Duplicate Variables in a SAS Data Set
Paper 1654-2018 Identifying Duplicate Variables in a SAS Data Set Bruce Gilsen, Federal Reserve Board, Washington, DC ABSTRACT In the big data era, removing duplicate data from a data set can reduce disk
More informationA Better Perspective of SASHELP Views
Paper PO11 A Better Perspective of SASHELP Views John R. Gerlach, Independent Consultant; Hamilton, NJ Abstract SASHELP views provide a means to access all kinds of information about a SAS session. In
More informationWriting Analytical Queries for Business Intelligence
MOC-55232 Writing Analytical Queries for Business Intelligence 3 Days Overview About this Microsoft SQL Server 2016 Training Course This three-day instructor led Microsoft SQL Server 2016 Training Course
More informationSQL: The Sequel. Phil Rhodes TAIR 2013 February 11, Concurrent Session A6
SQL: The Sequel Phil Rhodes TAIR 2013 February 11, 2013 Concurrent Session A6 Topics Brief review Subqueries Updating Data Conditional Logic Multi table joins Reporting Topics Brief review Subqueries Updating
More informationMTA Database Administrator Fundamentals Course
MTA Database Administrator Fundamentals Course Session 1 Section A: Database Tables Tables Representing Data with Tables SQL Server Management Studio Section B: Database Relationships Flat File Databases
More informationTips for Mastering Relational Databases Using SAS/ACCESS
Tips for Mastering Relational Databases Using SAS/ACCESS SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other
More information... ) city (city, cntyid, area, pop,.. )
PaperP829 PROC SQl - Is it a Required Tool for Good SAS Programming? Ian Whitlock, Westat Abstract No one SAS tool can be the answer to all problems. However, it should be hard to consider a SAS programmer
More informationDavid Beam, Systems Seminar Consultants, Inc., Madison, WI
Paper 150-26 INTRODUCTION TO PROC SQL David Beam, Systems Seminar Consultants, Inc., Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps
More informationPROC SQL VS. DATA STEP PROCESSING JEFF SIMPSON SAS CUSTOMER LOYALTY
PROC SQL VS. DATA STEP PROCESSING JEFF SIMPSON SAS CUSTOMER LOYALTY PROC SQL VS. DATA STEP What types of functionality do each provide Types of Joins Replicating joins using the data step How do each work
More informationEfficiently Join a SAS Data Set with External Database Tables
ABSTRACT Paper 2466-2018 Efficiently Join a SAS Data Set with External Database Tables Dadong Li, Michael Cantor, New York University Medical Center Joining a SAS data set with an external database is
More informationBetter Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables
Paper 3458-2015 Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables ABSTRACT Louise Hadden, Abt Associates Inc., Cambridge, MA SAS provides a wealth of resources for users to
More informationQuerying Data with Transact SQL
Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including
More informationPaper S Data Presentation 101: An Analyst s Perspective
Paper S1-12-2013 Data Presentation 101: An Analyst s Perspective Deanna Chyn, University of Michigan, Ann Arbor, MI Anca Tilea, University of Michigan, Ann Arbor, MI ABSTRACT You are done with the tedious
More informationBASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS
SAS COURSE CONTENT Course Duration - 40hrs BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS What is SAS History of SAS Modules available SAS GETTING STARTED
More informationLanguage. f SQL. Larry Rockoff COURSE TECHNOLOGY. Kingdom United States. Course Technology PTR. A part ofcenqaqe Learninq
Language f SQL Larry Rockoff Course Technology PTR A part ofcenqaqe Learninq *, COURSE TECHNOLOGY!» CENGAGE Learning- Australia Brazil Japan Korea Mexico Singapore Spain United Kingdom United States '
More informationPROC MEANS for Disaggregating Statistics in SAS : One Input Data Set and One Output Data Set with Everything You Need
ABSTRACT Paper PO 133 PROC MEANS for Disaggregating Statistics in SAS : One Input Data Set and One Output Data Set with Everything You Need Imelda C. Go, South Carolina Department of Education, Columbia,
More informationWorkbooks (File) and Worksheet Handling
Workbooks (File) and Worksheet Handling Excel Limitation Excel shortcut use and benefits Excel setting and custom list creation Excel Template and File location system Advanced Paste Special Calculation
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL Course: 20761 Course Details Audience(s): IT Professional(s) Technology: Microsoft SQL Server 2016 Duration: 24 HRs. ABOUT THIS COURSE This course is designed to introduce
More informationSAS Viya 3.1 FAQ for Processing UTF-8 Data
SAS Viya 3.1 FAQ for Processing UTF-8 Data Troubleshooting Tips for Processing UTF-8 Data (Existing SAS Code) What Is the Encoding of My Data Set? PROC CONTENTS displays information about the data set
More informationSQL Data Query Language
SQL Data Query Language André Restivo 1 / 68 Index Introduction Selecting Data Choosing Columns Filtering Rows Set Operators Joining Tables Aggregating Data Sorting Rows Limiting Data Text Operators Nested
More informationSAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC
PharmaSUG2010 - Paper TT06 SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC ABSTRACT One great leap that beginning and intermediate
More information10 The First Steps 4 Chapter 2
9 CHAPTER 2 Examples The First Steps 10 Invoking the Query Window 11 Changing Your Profile 11 ing a Table 13 ing Columns 14 Alias Names and Labels 14 Column Format 16 Creating a WHERE Expression 17 Available
More informationUsing PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO
Using PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO ABSTRACT The power of SAS programming can at times be greatly improved using PROC SQL statements for formatting and manipulating
More informationPlanting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny
Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Kathy Hardis Fraeman, United BioSource Corporation, Bethesda, MD ABSTRACT Often tables or summary
More informationComparison of different ways using table lookups on huge tables
PhUSE 007 Paper CS0 Comparison of different ways using table lookups on huge tables Ralf Minkenberg, Boehringer Ingelheim Pharma GmbH & Co. KG, Ingelheim, Germany ABSTRACT In many application areas the
More informationBeginning Tutorials. Paper 53-27
Paper 53-27 DATA Step vs. What s a neophyte to do? Craig Dickstein, Tamarack Professional Services, Weare, NH Ray Pass, Ray Pass Consulting, Hartsdale, NY ABSTRACT "What's all the buzz about Proc SQL?
More informationSAS Institute Exam A SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ]
s@lm@n SAS Institute Exam A00-212 SAS Advanced Programming Version: 6.0 [ Total Questions: 184 ] Question No : 1 The report will not successfully run and will produce an error message in the log. What
More informationSQL: Data Querying. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 4
B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 4 SQL: Data Querying Mar n Svoboda mar n.svoboda@fel.cvut.cz 20. 3. 2018 Czech Technical University
More informationUsing Recursion for More Convenient Macros
Paper BB-04 Using Recursion for More Convenient Macros Nate Derby, Stakana Analytics, Seattle, WA ABSTRACT There are times when a macro needs to alternatively be applied to either one value or a list of
More informationA Quick and Gentle Introduction to PROC SQL
ABSTRACT Paper B2B 9 A Quick and Gentle Introduction to PROC SQL Shane Rosanbalm, Rho, Inc. Sam Gillett, Rho, Inc. If you are afraid of SQL, it is most likely because you haven t been properly introduced.
More informationAdvanced SQL Tribal Data Workshop Joe Nowinski
Advanced SQL 2018 Tribal Data Workshop Joe Nowinski The Plan Live demo 1:00 PM 3:30 PM Follow along on GoToMeeting Optional practice session 3:45 PM 5:00 PM Laptops available What is SQL? Structured Query
More information20761 Querying Data with Transact SQL
Course Overview The main purpose of this course is to give students a good understanding of the Transact-SQL language which is used by all SQL Server-related disciplines; namely, Database Administration,
More informationChapter 2. Performing Advanced Queries Using PROC SQL
Chapter 2 Performing Advanced Queries Using PROC SQL 1 Displaying All Columns To select all columns included in a table use one of two options List all variables from the table in the select clause The
More information20461: Querying Microsoft SQL Server 2014 Databases
Course Outline 20461: Querying Microsoft SQL Server 2014 Databases Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions,
More informationQuerying Microsoft SQL Server
Course Code: M20461 Vendor: Microsoft Course Overview Duration: 5 RRP: POA Querying Microsoft SQL Server Overview This 5-day instructor led course provides delegates with the technical skills required
More informationBase and Advance SAS
Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS
More informationTop 5 Handy PROC SQL Tips You Didn t Think Were Possible
Top 5 Handy PROC SQL Tips You Didn t Think Were Possible Montreal SAS users Group 30 May 2018 11:00-11:40 Charu Shankar SAS Institute, Toronto About your presenter SAS Senior Technical Training Specialist,
More informationPrinciples of Data Management
Principles of Data Management Alvin Lin August 2018 - December 2018 Structured Query Language Structured Query Language (SQL) was created at IBM in the 80s: SQL-86 (first standard) SQL-89 SQL-92 (what
More informationDatabase Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and
More informationSubmitting SAS Code On The Side
ABSTRACT PharmaSUG 2013 - Paper AD24-SAS Submitting SAS Code On The Side Rick Langston, SAS Institute Inc., Cary NC This paper explains the new DOSUBL function and how it can submit SAS code to run "on
More information20461: Querying Microsoft SQL Server
20461: Querying Microsoft SQL Server Length: 5 days Audience: IT Professionals Level: 300 OVERVIEW This 5 day instructor led course provides students with the technical skills required to write basic Transact
More informationValidation Summary using SYSINFO
Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO
More informationQuerying Microsoft SQL Server (MOC 20461C)
Querying Microsoft SQL Server 2012-2014 (MOC 20461C) Course 21461 40 Hours This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for
More informationQuerying Microsoft SQL Server 2014
Querying Microsoft SQL Server 2014 Course: 20461 Course Details Audience(s): IT Professional(s) Technology: Microsoft SQL Server 2014 Duration: 40 Hours ABOUT THIS COURSE This forty hours of instructor-led
More informationAre Your SAS Programs Running You? Marje Fecht, Prowerk Consulting, Cape Coral, FL Larry Stewart, SAS Institute Inc., Cary, NC
Paper CS-044 Are Your SAS Programs Running You? Marje Fecht, Prowerk Consulting, Cape Coral, FL Larry Stewart, SAS Institute Inc., Cary, NC ABSTRACT Most programs are written on a tight schedule, using
More information[AVNICF-MCSASQL2012]: NICF - Microsoft Certified Solutions Associate (MCSA): SQL Server 2012
[AVNICF-MCSASQL2012]: NICF - Microsoft Certified Solutions Associate (MCSA): SQL Server 2012 Length Delivery Method : 5 Days : Instructor-led (Classroom) Course Overview Participants will learn technical
More informationChapter # 7 Introduction to Structured Query Language (SQL) Part II
Chapter # 7 Introduction to Structured Query Language (SQL) Part II Updating Table Rows UPDATE Modify data in a table Basic Syntax: UPDATE tablename SET columnname = expression [, columnname = expression]
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationCOURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014
COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 MODULE 1: INTRODUCTION TO MICROSOFT SQL SERVER 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions,
More informationTeradata SQL Features Overview Version
Table of Contents Teradata SQL Features Overview Version 14.10.0 Module 0 - Introduction Course Objectives... 0-4 Course Description... 0-6 Course Content... 0-8 Module 1 - Teradata Studio Features Optimize
More informationPharmaSUG China Mina Chen, Roche (China) Holding Ltd.
PharmaSUG China 2017-50 Writing Efficient Queries in SAS Using PROC SQL with Teradata Mina Chen, Roche (China) Holding Ltd. ABSTRACT The emergence of big data, as well as advancements in data science approaches
More informationOracle Database 11g: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL
More informationINTERMEDIATE SQL GOING BEYOND THE SELECT. Created by Brian Duffey
INTERMEDIATE SQL GOING BEYOND THE SELECT Created by Brian Duffey WHO I AM Brian Duffey 3 years consultant at michaels, ross, and cole 9+ years SQL user What have I used SQL for? ROADMAP Introduction 1.
More informationAVANTUS TRAINING PTE LTD
[MS20461]: Querying Microsoft SQL Server 2014 Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview This 5-day
More informationData Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.
PharmaSUG2011 - Paper DM03 Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc., TX ABSTRACT In the Clinical trials data analysis
More informationAdjusting for daylight saving times. PhUSE Frankfurt, 06Nov2018, Paper CT14 Guido Wendland
Adjusting for daylight saving times PhUSE Frankfurt, 06Nov2018, Paper CT14 Guido Wendland 1. The problem Page Introduction: DST (Daylight saving times) around the world 2 nd Sunday in March 1 st Sunday
More informationA Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN
Paper 045-29 A Format to Make the _TYPE_ Field of PROC MEANS Easier to Interpret Matt Pettis, Thomson West, Eagan, MN ABSTRACT: PROC MEANS analyzes datasets according to the variables listed in its Class
More informationSTATION
------------------------------STATION 1------------------------------ 1. Which of the following statements displays all user-defined macro variables in the SAS log? a) %put user=; b) %put user; c) %put
More informationObjectives Reading SAS Data Sets and Creating Variables Reading a SAS Data Set Reading a SAS Data Set onboard ia.dfwlax FirstClass Economy
Reading SAS Data Sets and Creating Variables Objectives Create a SAS data set using another SAS data set as input. Create SAS variables. Use operators and SAS functions to manipulate data values. Control
More informationMANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 6 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA
More informationUseful Tips from my Favorite SAS Resources
Useful Tips from my Favorite SAS Resources Marje Fecht Senior Partner, Prowerk Consulting Copyright 2017 Prowerk Consulting 1 You need an answer QUICK! I don t want to run the whole program if the input
More informationEfficient Processing of Long Lists of Variable Names
Efficient Processing of Long Lists of Variable Names Paulette W. Staum, Paul Waldron Consulting, West Nyack, NY ABSTRACT Many programmers use SAS macro language to manipulate lists of variable names. They
More informationAn Introduction to SAS/FSP Software Terry Fain, RAND, Santa Monica, California Cyndie Gareleck, RAND, Santa Monica, California
An Introduction to SAS/FSP Software Terry Fain, RAND, Santa Monica, California Cyndie Gareleck, RAND, Santa Monica, California ABSTRACT SAS/FSP is a set of procedures used to perform full-screen interactive
More informationJUST PASSING THROUGH OR ARE YOU? DETERMINE WHEN SQL PASS THROUGH OCCURS TO OPTIMIZE YOUR QUERIES Misty Johnson Wisconsin Department of Health
JUST PASSING THROUGH OR ARE YOU? DETERMINE WHEN SQL PASS THROUGH OCCURS TO OPTIMIZE YOUR QUERIES Misty Johnson Wisconsin Department of Health Services, Madison, WI Outline SAS/ACCESS SQL Pass Through Facility
More informationReady To Become Really Productive Using PROC SQL? Sunil K. Gupta, Gupta Programming, Simi Valley, CA
PharmaSUG 2012 - Paper HW04 Ready To Become Really Productive Using PROC SQL? Sunil K. Gupta, Gupta Programming, Simi Valley, CA ABSTRACT Using PROC SQL, can you identify at least four ways to: select
More informationDBLOAD Procedure Reference
131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options
More information4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML)
Since in the result relation each group is represented by exactly one tuple, in the select clause only aggregate functions can appear, or attributes that are used for grouping, i.e., that are also used
More informationQuerying Microsoft SQL Server 2008/2012
Querying Microsoft SQL Server 2008/2012 Course 10774A 5 Days Instructor-led, Hands-on Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL
More information