Table 1. Demog. id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8

Size: px
Start display at page:

Download "Table 1. Demog. id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8"

Transcription

1 Adding PROC SQL to your SAS toolbox for merging multiple tables without common variable names Susan Wancewicz, Moores Cancer Center, UCSD, La Jolla, CA ABSTRACT The SQL procedure offers an efficient method of creating a new dataset by merging tables in SAS. Advantages of PROC SQL over the SAS Merge statement include: tables do not need to be sorted before joining them; and tables without a common variable can be joined simultaneously. This paper will lead the SAS user through the following steps in PROC SQL: The basic join, join of tables without common variables, a demonstration of grouping variables in order to obtain a new variable containing the average of an existing variable. At the end of this discussion the SAS user will add flexibility to their SAS toolbox for creating a new merged table. INTRODUCTION The SAS Programmer is often confronted with data from multiple tables containing variable names which are different but refer to the same data. At times, these tables may need to be merged (joined) together for further processing. While it is possible to do this in SAS, using the MERGE and RENAME commands, PROC SQL offers another option. Topics will include the basic join with and without common variable names. In addition to the basic code there will be demonstration of unanticipated results and how to avoid them. The use of grouping will be discussed to create new variables. At the end of this paper the SAS user will have added a new tool to their SAS toolbox for joining tables. SAMPLE TABLES USED The following fictitious data sets will be used for this demonstration: Table 1. Demog id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8 The demog table contains 7 rows. The ID field always begins with the letter B. However, it was entered without regard to case. Education levels for the subjects was obtained and coded. This table is currently sorted by the id variable. Table 2. Ids id2 sid namelast dob B Ferry 3/6/1988 B CableCar 6/6/1987 b Scooter 2/4/1988 b Barge 3/3/1986 b Boat 9/9/1986 b Airplane 4/4/1987 b Walk 6/12/1988 b BART 8/8/1987 1

2 The ids table contains 8 rows which is one more row than the demog table. The variable id2 in the ids table refers to the same data as the variable id in the demog table. There is an additional row for subject b006 in the id table who is not listed in the demog table. We also have the variable sid which identifies the subject by a second id. Other variables in this table are namelast and dateofbirth. As seen in the demog table, the id2 information seems to have been entered without regard to case. This table is sorted by both id2 and sid. Table 3. Event sid questnum The event table has 24 rows and contains the variable SID which was seen in the id table. There is also a variable for questnum. Table 4. Nutrients intnum kcal fatgm carbgm proteingm

3 The nutrients table contains 24 rows. The intnum variable in the nutrients table contains the same information as the questnum variable in the event table. This table is sorted by the proteingm variable. USING THE SQL PROCEDURE JOINING TABLES USING PROC SQL Let us begin by joining the demog and ids tables using PROC SQL. We will be creating a new table called demogid. We want to select the variables id, education, sid, and namelast to include in our new table. We will be obtaining information from the table demog joined with the table ids. For the join variables we would like to use id from the demog table and id2 from the ids table. Notice there are two equally acceptable formats which may be used for the inner join example below. or CREATE TABLE demogid as SELECT id, id2, education, sid, namelast FROM demog d, ids i WHERE d.id = i.id2; CREATE TABLE demogid as SELECT id, education, sid, namelast FROM demog d JOIN ids i on d.id = i.id2; NOTE: Table WORK.DEMOGID created, with 6 rows and 4 columns. Output for DEMOGID: id id2 education sid namelast B002 B Ferry b005 b Scooter b007 b Boat b008 b Airplane b009 b Walk b010 b BART The newly created demogid table has only six rows but our two originating tables have seven and eight rows, respectively. Further investigation is in order to determine why we are missing data. Upon examination of the demog table we see id b003 is missing from our results. Let us try using a left join to force all of the variables from the table demog (on the left side of our join statement) to be in the new table. 3

4 CREATE TABLE demogidleft as SELECT id, id2, education, sid, namelast FROM demog d LEFT JOIN ids i on d.id = i.id2; NOTE: Table WORK.DEMOGIDLEFT created, with 7 rows and 5 columns. Output for DEMOGIDLEFT: id id2 education sid namelast B002 B Ferry b003 8 b005 b Scooter b007 b Boat b008 b Airplane b009 b Walk b010 b BART This looks better. We have the 7 rows found in the demog table but sid and namelast which are in the ids table are missing for id b003 (B003). We would like B003 in the ids table to match to b003 in the demog table. The next step will be to adjust our procedure for case sensitivity. We will use upcase to force all the letters to be uppercase for comparison purposes. CREATE TABLE demogidup as SELECT id, id2, education, sid, namelast FROM demog d LEFT JOIN ids i on upcase(d.id) = upcase(i.id2); NOTE: Table WORK.DEMOGIDUP created, with 7 rows and 5 columns. Output for DEMOGIDUP: id id2 education sid namelast B002 B Ferry b003 B CableCar b005 b Scooter b007 b Boat b008 b Airplane b009 b Walk b010 b BART As expected, we now have a row for each id in the demog table without any missing date. If we would like to see all of the data from the ids table we can use a right join. Let s see what happens if we use a right join instead of a left join. CREATE TABLE demogidrt as SELECT id, upcase(id2) as id2, education, sid, namelast FROM demog d RIGHT JOIN ids i on upcase(d.id) = upcase(i.id2); 4

5 NOTE: Table WORK.DEMOGIDRT created, with 8 rows and 5 columns. Output for DEMOGIDRT: id id2 education sid namelast B002 B Ferry b003 B CableCar b005 B Scooter B Barge b007 B Boat b008 B Airplane b009 B Walk b010 B BART As expected, we have 8 rows of data. Let s look at the output more closely. Since we used upcase in the select statement it was necessary to alias the resulting variable. In this case we used the same name id2. B006 is not in the demog table so we do not have an id or education value. For illustration both id and id2 have been included in the DEMOGIDRT table but only one of the variables would be necessary generally. GROUPING VARIABLES IN ORDER TO OBTAIN A NEW VARIABLE Looking at the nutrients table (table 4) we see some nutrition information for the intnum variable. We would like to join the newly created demogidrt table with the nutrients table. It will be necessary to use the event table as a bridge between the demogidrt and nutrients tables. The demogidrt table and the event table have a common variable sid so we will join them first. Notice that the demogidrt table is sorted by sid while the event table is sorted by questnum. Secondly, we will join the nutrients table using intnum from the nutrients table and questnum from the event table. We would also like to create variables for averages of the various nutrients. To improve readability of our results we will use order by to sort the table by id2. The wildcard * is also used to include all of the results from the table demogidrt. CREATE TABLE Nutrient as SELECT d.*, avg(kcal) as avgkcal, avg(fatgm) as avgfat, avg(carbgm) as avgcarb, avg(proteingm) as avgprotein FROM demogidrt d LEFTt JOIN event e ON d.sid = e.sid LEFT JOIN nutrients n ON e.questnum = n.intnum GROUP BY id2 ORDER BY id2; NOTE: The query requires remerging summary statistics back with the original data. NOTE: Table WORK.NUTRIENT created, with 26 rows and 9 columns. Output for NUTRIENT: id id2 education sid namelast avgkcal avgfat avgcarb avgprotein b003 B CableCar b003 B CableCar

6 b003 B CableCar b003 B CableCar b005 B Scooter b005 B Scooter b005 B Scooter b005 B Scooter B Barge b007 B Boat b007 B Boat b007 B Boat b007 B Boat b008 B Airplane b008 B Airplane b008 B Airplane b008 B Airplane b009 B Walk b009 B Walk b009 B Walk b009 B Walk b010 B BART There seems to be a problem with this table. We have multiple rows of data with exactly the same information. The nutrient information for B006 and b010 is in fact not present in the nutrient table. Let s use DISTINCT to eliminate the multiple row problem. CREATE TABLE Nutrientdistinct as SELECT DISTINCT id2, d.*, avg(kcal) as avgkcal, avg(fatgm) as avgfat, avg(carbgm) as avgcarb, avg(proteingm) as avgprotein FROM demogidrt d LEFT JOIN event e ON d.sid = e.sid LEFT JOIN nutrients n ON e.questnum = n.intnum GROUP BY id2 ORDER BY id2; WARNING: Column named id2 is duplicated in a select expression (or a view). Explicit references to it will be to the first one. NOTE: The query requires remerging summary statistics back with the original data. WARNING: Variable id2 already exists on file WORK.NUTRIENTDISTINCT. NOTE: Table WORK.NUTRIENTDISTINCT created, with 8 rows and 9 columns. Output for NUTRIENTDISTINCT: id2 id education sid namelast avgkcal avgfat avgcarb avgprotein B003 b CableCar B005 b Scooter B Barge B007 b Boat B008 b Airplane B009 b Walk B010 b BART 6

7 The use of distinct did give us one row of data for each distinct id2. In the final example we would like to subset our data by only including data where the last name is a common form of public transportation in San Francisco. CREATE TABLE NutrientSF as SELECT DISTINCT id2, d.*, avg(kcal) as avgkcal, avg(fatgm) as avgfat, avg(carbgm) as avgcarb, avg(proteingm) as avgprotein FROM demogidrt d LEFT JOIN event e ON d.sid = e.sid LEFT JOIN nutrients n ON e.questnum = n.intnum WHERE namelast in ('BART', 'CableCar', 'Ferry') GROUP BY id2 ORDER BY id2; WARNING: Column named id2 is duplicated in a select expression (or a view). Explicit references to it will be to the first one. NOTE: The query requires remerging summary statistics back with the original data. WARNING: Variable id2 already exists on file WORK.NUTRIENTSF. NOTE: Table WORK.NUTRIENTSF created, with 3 rows and 9 columns. Output for NUTRIENTSF: id2 id education sid namelast avgkcal avgfat avgcarb avgprotein B003 b CableCar B010 b BART With the use of IN we are able to include only the last name Ferry, CableCar and BART in the NUTRIENTSF table. CONCLUSION Using Proc SQL can add versatility to your SAS repertoire. The SAS programmer should now have a basic understanding of joining tables as well as an appreciation for some of the potential problems. By using PROC SQL, steps can be saved in presorting, grouping and joining tables without common variable names. While PROC SQL may not always be the right choice for your application it adds another tool to your SAS toolbox. REFERENCES Delwich, Lora D. and Susan J. Slaughter The Little SAS Book: A Primer, Third Edition. Cary, NC: Sas Institute Inc. Prairie, Katherine The Essential PROC SQL Handbook for SAS Users. The Essential PROC SQL Handbook for SAS Users. Cary, NC: SAS Institute Inc. ACKOWLEGEMENTS Thank you to Shirley Flatt and Martha White for their assistance in bringing this paper to fruition. 7

8 CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Susan Wancewicz University of California, San Diego 8

The Essentials of Finding the Distinct, Unique, and Duplicate Values in Your Data

The Essentials of Finding the Distinct, Unique, and Duplicate Values in Your Data The Essentials of Finding the Distinct, Unique, and Duplicate Values in Your Data Carter Sevick MS, DoD Center for Deployment Health Research, San Diego, CA ABSTRACT Whether by design or by error there

More information

One problem > Multiple solutions; various ways of removing duplicates from dataset using SAS Jaya Dhillon, Louisiana State University

One problem > Multiple solutions; various ways of removing duplicates from dataset using SAS Jaya Dhillon, Louisiana State University One problem > Multiple solutions; various ways of removing duplicates from dataset using SAS Jaya Dhillon, Louisiana State University ABSTRACT In real world, analysts seldom come across data which is in

More information

Subsetting Observations from Large SAS Data Sets

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

More information

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. 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

More information

Using Proc SQL and ODBC to Manage Data outside of SAS Jeff Magouirk, National Jewish Medical and Research Center, Denver, Colorado

Using Proc SQL and ODBC to Manage Data outside of SAS Jeff Magouirk, National Jewish Medical and Research Center, Denver, Colorado Using Proc SQL and ODBC to Manage Data outside of SAS Jeff Magouirk, National Jewish Medical and Research Center, Denver, Colorado ABSTRACT The ability to use Proc SQL and ODBC to manage data outside of

More information

Foundations & Fundamentals. A PROC SQL Primer. Matt Taylor, Carolina Analytical Consulting, LLC, Charlotte, NC

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

More information

An Approach to Creating Archives That Minimizes Storage Requirements

An Approach to Creating Archives That Minimizes Storage Requirements Paper SC-008 An Approach to Creating Archives That Minimizes Storage Requirements Ruben Chiflikyan, RTI International, Research Triangle Park, NC Mila Chiflikyan, RTI International, Research Triangle Park,

More information

Alternatives to Merging SAS Data Sets But Be Careful

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

More information

Using DATA Step MERGE and PROC SQL JOIN to Combine SAS Datasets Dalia C. Kahane, Westat, Rockville, MD

Using DATA Step MERGE and PROC SQL JOIN to Combine SAS Datasets Dalia C. Kahane, Westat, Rockville, MD Using DATA Step MERGE and PROC SQL JOIN to Combine SAS Datasets Dalia C. Kahane, Westat, Rockville, MD ABSTRACT This paper demonstrates important features of combining datasets in SAS. The facility to

More information

Fun with PROC SQL Darryl Putnam, CACI Inc., Stevensville MD

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,

More information

Normalizing SAS Datasets Using User Define Formats

Normalizing SAS Datasets Using User Define Formats Normalizing SAS Datasets Using User Define Formats David D. Chapman, US Census Bureau, Washington, DC ABSTRACT Normalization is a database concept used to eliminate redundant data, increase computational

More information

Chapter 1 Overview of the SQL Procedure

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

More information

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. 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

More information

Performing Queries Using PROC SQL (1)

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

More information

Paper 109-25 Merges and Joins Timothy J Harrington, Trilogy Consulting Corporation

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

More information

Intelligent Query and Reporting against DB2. Jens Dahl Mikkelsen SAS Institute A/S

Intelligent Query and Reporting against DB2. Jens Dahl Mikkelsen SAS Institute A/S Intelligent Query and Reporting against DB2 Jens Dahl Mikkelsen SAS Institute A/S DB2 Reporting Pains Difficult and slow to get information on available tables and columns table and column contents/definitions

More information

Enhanced Search Results for Service Providers (SCR 8611A)

Enhanced Search Results for Service Providers (SCR 8611A) The current structure when creating Service Provider information requires that an individual record is created for each unique address. This results in many duplicate and inaccurate data records and increased

More information

MWSUG 2011 - Paper S111

MWSUG 2011 - Paper S111 MWSUG 2011 - Paper S111 Dealing with Duplicates in Your Data Joshua M. Horstman, First Phase Consulting, Inc., Indianapolis IN Roger D. Muller, First Phase Consulting, Inc., Carmel IN Abstract As SAS programmers,

More information

Improve Your Queries; Hints and Tips for Using SQL Marje Fecht, Prowerk Consulting, Mississauga, Ontario, Canada Linda Mitterling, SAS, Cary, NC

Improve Your Queries; Hints and Tips for Using SQL Marje Fecht, Prowerk Consulting, Mississauga, Ontario, Canada Linda Mitterling, SAS, Cary, NC Paper 270-29 Improve Your Queries; Hints and Tips for Using SQL Marje Fecht, Prowerk Consulting, Mississauga, Ontario, Canada Linda Mitterling, SAS, Cary, NC ABSTRACT Are you using PROC SQL but never quite

More information

Preparing Real World Data in Excel Sheets for Statistical Analysis

Preparing Real World Data in Excel Sheets for Statistical Analysis Paper DM03 Preparing Real World Data in Excel Sheets for Statistical Analysis Volker Harm, Bayer Schering Pharma AG, Berlin, Germany ABSTRACT This paper collects a set of techniques of importing Excel

More information

Effective Use of SQL in SAS Programming

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

More information

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

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

More information

Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports

Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports Jeff Cai, Amylin Pharmaceuticals, Inc., San Diego, CA Jay Zhou, Amylin Pharmaceuticals, Inc., San Diego, CA ABSTRACT To supplement Oracle

More information

SQL SUBQUERIES: Usage in Clinical Programming. Pavan Vemuri, PPD, Morrisville, NC

SQL SUBQUERIES: Usage in Clinical Programming. Pavan Vemuri, PPD, Morrisville, NC PharmaSUG 2013 Poster # P015 SQL SUBQUERIES: Usage in Clinical Programming Pavan Vemuri, PPD, Morrisville, NC ABSTRACT A feature of PROC SQL which provides flexibility to SAS users is that of a SUBQUERY.

More information

From Database to your Desktop: How to almost completely automate reports in SAS, with the power of Proc SQL

From Database to your Desktop: How to almost completely automate reports in SAS, with the power of Proc SQL From Database to your Desktop: How to almost completely automate reports in SAS, with the power of Proc SQL Kirtiraj Mohanty, Department of Mathematics and Statistics, San Diego State University, San Diego,

More information

Can SAS Enterprise Guide do all of that, with no programming required? Yes, it can.

Can SAS Enterprise Guide do all of that, with no programming required? Yes, it can. SAS Enterprise Guide for Educational Researchers: Data Import to Publication without Programming AnnMaria De Mars, University of Southern California, Los Angeles, CA ABSTRACT In this workshop, participants

More information

a presentation by Kirk Paul Lafler SAS Consultant, Author, and Trainer E-mail: KirkLafler@cs.com

a presentation by Kirk Paul Lafler SAS Consultant, Author, and Trainer E-mail: KirkLafler@cs.com a presentation by Kirk Paul Lafler SAS Consultant, Author, and Trainer E-mail: KirkLafler@cs.com 1 Copyright Kirk Paul Lafler, 1992-2010. All rights reserved. SAS is the registered trademark of SAS Institute

More information

Statistics and Analysis. Quality Control: How to Analyze and Verify Financial Data

Statistics and Analysis. Quality Control: How to Analyze and Verify Financial Data Abstract Quality Control: How to Analyze and Verify Financial Data Michelle Duan, Wharton Research Data Services, Philadelphia, PA As SAS programmers dealing with massive financial data from a variety

More information

SAS Programming Tips, Tricks, and Techniques

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

More information

CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases

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

More information

A Day in the Life of Data Part 2

A Day in the Life of Data Part 2 ABSTRACT Paper 117-2013 A Day in the Life of Data Part 2 Harry Droogendyk, Stratia Consulting Inc. As a new SAS programmer, you may be overwhelmed with the variety of tricks and techniques that you see

More information

REx: An Automated System for Extracting Clinical Trial Data from Oracle to SAS

REx: An Automated System for Extracting Clinical Trial Data from Oracle to SAS REx: An Automated System for Extracting Clinical Trial Data from Oracle to SAS Edward McCaney, Centocor Inc., Malvern, PA Gail Stoner, Centocor Inc., Malvern, PA Anthony Malinowski, Centocor Inc., Malvern,

More information

Oracle Database 10g: Introduction to SQL

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.

More information

PH 7525 Introduction to Data & Statistical Packages Course Reference #: 18254 Spring 2011

PH 7525 Introduction to Data & Statistical Packages Course Reference #: 18254 Spring 2011 PH 7525 Introduction to Data & Statistical Packages Course Reference #: 18254 Spring 2011 Scott R. Weaver, Ph.D. Division of Epidemiology & Biostatistics Course Basics Faculty Accessibility Class Day/Time:

More information

Paper 2917. Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA

Paper 2917. Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA Paper 2917 Creating Variables: Traps and Pitfalls Olena Galligan, Clinops LLC, San Francisco, CA ABSTRACT Creation of variables is one of the most common SAS programming tasks. However, sometimes it produces

More information

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 5 Retreiving Data from Multiple Tables Eng. Alaa O Shama November, 2015 Objectives:

More information

PROC SQL for DATA Step Die-Hards Christianna S. Williams, Yale University

PROC SQL for DATA Step Die-Hards Christianna S. Williams, Yale University PROC SQL for DATA Step Die-Hards Christianna S. Williams, Yale University ABSTRACT PROC SQL can be rather intimidating for those who have learned SAS data management techniques exclusively using the DATA

More information

Simple Rules to Remember When Working with Indexes Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California

Simple Rules to Remember When Working with Indexes Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Simple Rules to Remember When Working with Indexes Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Abstract SAS users are always interested in learning techniques related

More information

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix Jennifer Clegg, SAS Institute Inc., Cary, NC Eric Hill, SAS Institute Inc., Cary, NC ABSTRACT Release 2.1 of SAS

More information

Using the SQL Procedure

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

More information

Return of the Codes: SAS, Windows, and Your s Mark Tabladillo, Ph.D., MarkTab Consulting, Atlanta, GA Associate Faculty, University of Phoenix

Return of the Codes: SAS, Windows, and Your s Mark Tabladillo, Ph.D., MarkTab Consulting, Atlanta, GA Associate Faculty, University of Phoenix Paper AP-11 Return of the Codes: SAS, Windows, and Your s Mark Tabladillo, Ph.D., MarkTab Consulting, Atlanta, GA Associate Faculty, University of Phoenix ABSTRACT Robust applications participate in the

More information

KEY FEATURES OF SOURCE CONTROL UTILITIES

KEY FEATURES OF SOURCE CONTROL UTILITIES Source Code Revision Control Systems and Auto-Documenting Headers for SAS Programs on a UNIX or PC Multiuser Environment Terek Peterson, Alliance Consulting Group, Philadelphia, PA Max Cherny, Alliance

More information

Demystifying PROC SQL Join Algorithms Kirk Paul Lafler, Software Intelligence Corporation

Demystifying PROC SQL Join Algorithms Kirk Paul Lafler, Software Intelligence Corporation Paper TU01 Demystifying PROC SQL Join Algorithms Kirk Paul Lafler, Software Intelligence Corporation ABSTRACT When it comes to performing PROC SQL joins, users supply the names of the tables for joining

More information

Data Warehousing With Microsoft Access

Data Warehousing With Microsoft Access R. Jason Weiss Development Dimensions International This issue s edition of the Leading Edge was submitted by guest writer Robert J. Townsend. Data Warehousing With Microsoft Access Robert J. Townsend

More information

DBF Chapter. Note to UNIX and OS/390 Users. Import/Export Facility CHAPTER 7

DBF Chapter. Note to UNIX and OS/390 Users. Import/Export Facility CHAPTER 7 97 CHAPTER 7 DBF Chapter Note to UNIX and OS/390 Users 97 Import/Export Facility 97 Understanding DBF Essentials 98 DBF Files 98 DBF File Naming Conventions 99 DBF File Data Types 99 ACCESS Procedure Data

More information

Let SAS Modify Your Excel File Nelson Lee, Genentech, South San Francisco, CA

Let SAS Modify Your Excel File Nelson Lee, Genentech, South San Francisco, CA ABSTRACT PharmaSUG 2015 - Paper QT12 Let SAS Modify Your Excel File Nelson Lee, Genentech, South San Francisco, CA It is common to export SAS data to Excel by creating a new Excel file. However, there

More information

SAS Views The Best of Both Worlds

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

More information

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query Objectives The objective of this lab is to learn the query language of SQL. Outcomes After completing this Lab,

More information

Data Presentation. Paper 126-27. Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs

Data Presentation. Paper 126-27. Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs Paper 126-27 Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs Tugluke Abdurazak Abt Associates Inc. 1110 Vermont Avenue N.W. Suite 610 Washington D.C. 20005-3522

More information

Table Lookups: From IF-THEN to Key-Indexing

Table Lookups: From IF-THEN to Key-Indexing Paper 158-26 Table Lookups: From IF-THEN to Key-Indexing Arthur L. Carpenter, California Occidental Consultants ABSTRACT One of the more commonly needed operations within SAS programming is to determine

More information

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 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

More information

Big Data, Fast Processing Speeds Kevin McGowan SAS Solutions on Demand, Cary NC

Big Data, Fast Processing Speeds Kevin McGowan SAS Solutions on Demand, Cary NC Big Data, Fast Processing Speeds Kevin McGowan SAS Solutions on Demand, Cary NC ABSTRACT As data sets continue to grow, it is important for programs to be written very efficiently to make sure no time

More information

Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables. Lesson C Objectives. Joining Multiple Tables

Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables. Lesson C Objectives. Joining Multiple Tables Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables Wednesay 9/24/2014 Abdou Illia MIS 4200 - Fall 2014 Lesson C Objectives After completing this lesson, you should be able

More information

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 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

More information

SET The SET statement is often used in two ways copying and appending.

SET The SET statement is often used in two ways copying and appending. Point, Set, Match (Merge) A Beginner s Lesson Jennifer Hoff Lindquist, Institute for Clinical and Epidemiologic Research, Veterans Affairs Medical Center, Durham, NC The phrase Point, Set and Match is

More information

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 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

More information

Imelda C. Go, South Carolina Department of Education, Columbia, SC

Imelda C. Go, South Carolina Department of Education, Columbia, SC PO 003 Matching SAS Data Sets with PROC SQL: If at First You Don t Succeed, Match, Match Again ABSTRACT Imelda C. Go, South Carolina Department of Education, Columbia, SC Two data sets are often matched

More information

Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL)

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

More information

How To Use Sas With A Computer System Knowledge Management (Sas)

How To Use Sas With A Computer System Knowledge Management (Sas) Paper AD13 Medical Coding System for Clinical Trials 21 CFR Part 11 Compliant SAS/AF Application Annie Guo, ICON Clinical Research, Redwood City, CA ABSTRACT Medical coding in clinical trials is to classify

More information

Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board

Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board Tales from the Help Desk 3: More Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 20 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users make

More information

Information Systems SQL. Nikolaj Popov

Information Systems SQL. Nikolaj Popov Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline SQL Table Creation Populating and Modifying

More information

Beyond the Simple SAS Merge. Vanessa L. Cox, MS 1,2, and Kimberly A. Wildes, DrPH, MA, LPC, NCC 3. Cancer Center, Houston, TX. vlcox@mdanderson.

Beyond the Simple SAS Merge. Vanessa L. Cox, MS 1,2, and Kimberly A. Wildes, DrPH, MA, LPC, NCC 3. Cancer Center, Houston, TX. vlcox@mdanderson. Beyond the Simple SAS Merge Vanessa L. Cox, MS 1,2, and Kimberly A. Wildes, DrPH, MA, LPC, NCC 3 1 General Internal Medicine and Ambulatory Treatment, The University of Texas MD Anderson Cancer Center,

More information

Click to create a query in Design View. and click the Query Design button in the Queries group to create a new table in Design View.

Click to create a query in Design View. and click the Query Design button in the Queries group to create a new table in Design View. Microsoft Office Access 2010 Understanding Queries Queries are questions you ask of your database. They allow you to select certain fields out of a table, or pull together data from various related tables

More information

car boat airplane train taxi bus motorcycle ambulance bicycle tricycle horse mule scooter

car boat airplane train taxi bus motorcycle ambulance bicycle tricycle horse mule scooter car boat airplane train taxi bus cycle ambulance bicycle tricycle horse mule scooter ice SUV truck spaceship camel cable car ferry boat car airplane horse taxi bus cycle ambulance bicycle tricycle cable

More information

Managing Tables in Microsoft SQL Server using SAS

Managing Tables in Microsoft SQL Server using SAS Managing Tables in Microsoft SQL Server using SAS Jason Chen, Kaiser Permanente, San Diego, CA Jon Javines, Kaiser Permanente, San Diego, CA Alan L Schepps, M.S., Kaiser Permanente, San Diego, CA Yuexin

More information

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 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

More information

BRIO QUERY FUNCTIONALITY IN COMPARISION TO CRYSTAL REPORTS

BRIO QUERY FUNCTIONALITY IN COMPARISION TO CRYSTAL REPORTS BRIO QUERY FUNCTIONALITY IN COMPARISION TO CRYSTAL REPORTS Category Downstream Analysis Nested Queries Brio Functionality Ability to create data sets Ability to create tables and upload tables Available

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

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

More information

USING SAS WITH ORACLE PRODUCTS FOR DATABASE MANAGEMENT AND REPORTING

USING SAS WITH ORACLE PRODUCTS FOR DATABASE MANAGEMENT AND REPORTING USING SAS WITH ORACLE PRODUCTS FOR DATABASE MANAGEMENT AND REPORTING Henry W. Buffum, R. O. W. ScIences, Inc. Darryl J. Keith, U.S. Environmental Protection Agency Abstract: Data for a large environmental

More information

Managing Clinical Trials Data using SAS Software

Managing Clinical Trials Data using SAS Software Paper DM08 Managing Clinical Trials Data using SAS Software Martin J. Rosenberg, Ph.D., MAJARO InfoSystems, Inc. ABSTRACT For over five years, one of the largest clinical trials ever conducted (over 670,000

More information

Relational Database: Additional Operations on Relations; SQL

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

More information

SAS/ACCESS 9.3 Interface to PC Files

SAS/ACCESS 9.3 Interface to PC Files SAS/ACCESS 9.3 Interface to PC Files Reference SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2011. SAS/ACCESS 9.3 Interface to Files: Reference.

More information

Introduction to Proc SQL Steven First, Systems Seminar Consultants, Madison, WI

Introduction to Proc SQL Steven First, Systems Seminar Consultants, Madison, WI 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

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Title. Syntax. stata.com. odbc Load, write, or view data from ODBC sources. List ODBC sources to which Stata can connect odbc list

Title. Syntax. stata.com. odbc Load, write, or view data from ODBC sources. List ODBC sources to which Stata can connect odbc list Title stata.com odbc Load, write, or view data from ODBC sources Syntax Menu Description Options Remarks and examples Also see Syntax List ODBC sources to which Stata can connect odbc list Retrieve available

More information

Introduction. Why Use ODBC? Setting Up an ODBC Data Source. Stat/Math - Getting Started Using ODBC with SAS and SPSS

Introduction. Why Use ODBC? Setting Up an ODBC Data Source. Stat/Math - Getting Started Using ODBC with SAS and SPSS Introduction Page 1 of 15 The Open Database Connectivity (ODBC) standard is a common application programming interface for accessing data files. In other words, ODBC allows you to move data back and forth

More information

SAS Data Views: A Virtual View of Data John C. Boling, SAS Institute Inc., Cary, NC

SAS Data Views: A Virtual View of Data John C. Boling, SAS Institute Inc., Cary, NC SAS Data Views: A Virtual View of Data John C. Boling, SAS Institute Inc., Cary, NC ABSTRACT The concept of a SAS data set has been extended or broadened in Version 6 of the SAS System. Two SAS file structures

More information

Using SAS as a Relational Database

Using SAS as a Relational Database Using SAS as a Relational Database Yves DeGuire Statistics Canada Come out of the desert of ignorance to the OASUS of knowledge Introduction Overview of relational database concepts Why using SAS as a

More information

Tutorial 3. Maintaining and Querying a Database

Tutorial 3. Maintaining and Querying a Database Tutorial 3 Maintaining and Querying a Database Microsoft Access 2010 Objectives Find, modify, and delete records in a table Learn how to use the Query window in Design view Create, run, and save queries

More information

Microsoft Office 2010

Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database Microsoft Office 2010 Objectives Find, modify, and delete records in a table Learn how to use the Query window in Design view Create, run, and save

More information

Q1. Where else, other than your home, do you use the internet? (Check all that apply). Library School Workplace Internet on a cell phone Other

Q1. Where else, other than your home, do you use the internet? (Check all that apply). Library School Workplace Internet on a cell phone Other Exploring Check-All Questions: Frequencies, Multiple Response, and Aggregation Target Software & Version: SPSS v19 Last Updated on May 4, 2012 Created by Laura Atkins Sometimes several responses or measurements

More information

Web Intelligence User Guide

Web Intelligence User Guide Web Intelligence User Guide Office of Financial Management - Enterprise Reporting Services 4/11/2011 Table of Contents Chapter 1 - Overview... 1 Purpose... 1 Chapter 2 Logon Procedure... 3 Web Intelligence

More information

New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency

New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency New Tricks for an Old Tool: Using Custom Formats for Data Validation and Program Efficiency S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT PROC FORMAT is one of the old standards among SAS Procedures,

More information

9.1 SAS/ACCESS. Interface to SAP BW. User s Guide

9.1 SAS/ACCESS. Interface to SAP BW. User s Guide SAS/ACCESS 9.1 Interface to SAP BW User s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS/ACCESS 9.1 Interface to SAP BW: User s Guide. Cary, NC: SAS

More information

Introduction to Criteria-based Deduplication of Records, continued SESUG 2012

Introduction to Criteria-based Deduplication of Records, continued SESUG 2012 SESUG 2012 Paper CT-11 An Introduction to Criteria-based Deduplication of Records Elizabeth Heath RTI International, RTP, NC Priya Suresh RTI International, RTP, NC ABSTRACT When survey respondents are

More information

Reshaping & Combining Tables Unit of analysis Combining. Assignment 4. Assignment 4 continued PHPM 672/677 2/21/2016. Kum 1

Reshaping & Combining Tables Unit of analysis Combining. Assignment 4. Assignment 4 continued PHPM 672/677 2/21/2016. Kum 1 Reshaping & Combining Tables Unit of analysis Combining Reshaping set: concatenate tables (stack rows) merge: link tables (attach columns) proc summary: consolidate rows proc transpose: reshape table Hye-Chung

More information

Top Ten Reasons to Use PROC SQL

Top Ten Reasons to Use PROC SQL Paper 042-29 Top Ten Reasons to Use PROC SQL Weiming Hu, Center for Health Research Kaiser Permanente, Portland, Oregon, USA ABSTRACT Among SAS users, it seems there are two groups of people, those who

More information

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI Paper BtB-16 Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI SESUG 2013 ABSTRACT When dealing with data from multiple or unstructured

More information

Dashboard Admin Guide

Dashboard Admin Guide MadCap Software Dashboard Admin Guide Pulse Copyright 2014 MadCap Software. All rights reserved. Information in this document is subject to change without notice. The software described in this document

More information

KEYWORDS ARRAY statement, DO loop, temporary arrays, MERGE statement, Hash Objects, Big Data, Brute force Techniques, PROC PHREG

KEYWORDS ARRAY statement, DO loop, temporary arrays, MERGE statement, Hash Objects, Big Data, Brute force Techniques, PROC PHREG Paper BB-07-2014 Using Arrays to Quickly Perform Fuzzy Merge Look-ups: Case Studies in Efficiency Arthur L. Carpenter California Occidental Consultants, Anchorage, AK ABSTRACT Merging two data sets when

More information

UNIX Operating Environment

UNIX Operating Environment 97 CHAPTER 14 UNIX Operating Environment Specifying File Attributes for UNIX 97 Determining the SAS Release Used to Create a Member 97 Creating a Transport File on Tape 98 Copying the Transport File from

More information

Intro to Longitudinal Data: A Grad Student How-To Paper Elisa L. Priest 1,2, Ashley W. Collinsworth 1,3 1

Intro to Longitudinal Data: A Grad Student How-To Paper Elisa L. Priest 1,2, Ashley W. Collinsworth 1,3 1 Intro to Longitudinal Data: A Grad Student How-To Paper Elisa L. Priest 1,2, Ashley W. Collinsworth 1,3 1 Institute for Health Care Research and Improvement, Baylor Health Care System 2 University of North

More information

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

Configuring an Alternative Database for SAS Web Infrastructure Platform Services Configuration Guide Configuring an Alternative Database for SAS Web Infrastructure Platform Services By default, SAS Web Infrastructure Platform Services is configured to use SAS Framework Data Server.

More information

Overview. NT Event Log. CHAPTER 8 Enhancements for SAS Users under Windows NT

Overview. NT Event Log. CHAPTER 8 Enhancements for SAS Users under Windows NT 177 CHAPTER 8 Enhancements for SAS Users under Windows NT Overview 177 NT Event Log 177 Sending Messages to the NT Event Log Using a User-Written Function 178 Examples of Using the User-Written Function

More information

Advanced Query for Query Developers

Advanced Query for Query Developers for Developers This is a training guide to step you through the advanced functions of in NUFinancials. is an ad-hoc reporting tool that allows you to retrieve data that is stored in the NUFinancials application.

More information

Everything you wanted to know about MERGE but were afraid to ask

Everything you wanted to know about MERGE but were afraid to ask TS- 644 Janice Bloom Everything you wanted to know about MERGE but were afraid to ask So you have read the documentation in the SAS Language Reference for MERGE and it still does not make sense? Rest assured

More information

Data Warehousing. Paper 133-25

Data Warehousing. Paper 133-25 Paper 133-25 The Power of Hybrid OLAP in a Multidimensional World Ann Weinberger, SAS Institute Inc., Cary, NC Matthias Ender, SAS Institute Inc., Cary, NC ABSTRACT Version 8 of the SAS System brings powerful

More information

The SET Statement and Beyond: Uses and Abuses of the SET Statement. S. David Riba, JADE Tech, Inc., Clearwater, FL

The SET Statement and Beyond: Uses and Abuses of the SET Statement. S. David Riba, JADE Tech, Inc., Clearwater, FL The SET Statement and Beyond: Uses and Abuses of the SET Statement S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT The SET statement is one of the most frequently used statements in the SAS System.

More information

Normalized EditChecks Automated Tracking (N.E.A.T.) A SAS solution to improve clinical data cleaning

Normalized EditChecks Automated Tracking (N.E.A.T.) A SAS solution to improve clinical data cleaning Normalized EditChecks Automated Tracking (N.E.A.T.) A SAS solution to improve clinical data cleaning Frank Fan, Clinovo, Sunnyvale, CA Ale Gicqueau, Clinovo, Sunnyvale, CA WUSS 2010 annual conference November

More information

Programming Idioms Using the SET Statement

Programming Idioms Using the SET Statement Programming Idioms Using the SET Statement Jack E. Fuller, Trilogy Consulting Corporation, Kalamazoo, MI ABSTRACT While virtually every programmer of base SAS uses the SET statement, surprisingly few programmers

More information