SAS and SQL "Join" Forces to Perform a Many-to-Many Merge Ginny P. Lai, Eric P. Elkin ICON Clinical Research, San Francisco, CA

Size: px
Start display at page:

Download "SAS and SQL "Join" Forces to Perform a Many-to-Many Merge Ginny P. Lai, Eric P. Elkin ICON Clinical Research, San Francisco, CA"

Transcription

1 SAS and SQL "Join" Forces to Perform a Many-to-Many Merge Ginny P. Lai, Eric P. Elkin ICON Clinical Research, San Francisco, CA ABSTRACT Many-to-many merge refers to specific instances where there is a need to merge two or more data sources with multiple observations for key identifiers. For example, it would be important to merge a dataset containing one record per patient per medical visit and a dataset containing one record per patient per lab test for the purpose of identifying the medical visit closest to each lab result for each patient. SAS generally can not handle a many-to-many merge properly by a simple MERGE-BY statement (although a complex MERGE accompanying an advanced DATA step can be used). In this situation, an easier and more straightforward alternative is to employ PROC SQL under SAS/Base. This talk will focus on basic PROC SQL syntax for non-sql programmers in order to perform a many-tomany merge. INTRODUCTION At times it is necessary to perform a many-to-many merge in contrast to a one-to-one or one-to many merge. In this case, a programmer needs to combine all the rows from one table with all the rows from another table. A MERGE accompanying an advanced DATA step can be used but this is complex and time consuming. PROC SQL presents a powerful alternative tool which is much simpler and more straightforward for performing a many-to-many merge. The purpose of this paper is to demonstrate many-to-many merging using basic PROC SQL syntax for SAS users with knowledge of DATA step but little-to-no PROC SQL experience. SAMPLE DATA In this paper, two datasets (shown below) will be used as our example to illustrate a many-to-may merge. Imagine we have a dataset of medical visit data and a dataset of lab result data. First, we want to find all visit records within five days of each lab date for each patient. Note that both datasets have a common patient ID (PATID) with multiple visits or lab results per patient. PATID VID VISDATE VISTYP E Jan Jan Feb Feb Mar Mar Mar Apr Jan Jan Feb Mar Mar Mar Mar Jan Jan Apr Feb

2 Feb Mar Mar Apr Apr Apr May Jan Jan Feb Feb Feb Mar Mar Mar Apr Apr Apr Apr May patid labid labdate pcs mcs Jan Feb Mar Apr May Jan Feb Mar Apr May Jan Feb Mar Apr May Jan Feb Mar Apr May Jan Feb Mar Apr May

3 MERGING VS. JOINIG The following output shows what happens when you combine datasets with multiple records per unique key using a traditional MERGE-BY statement. Take patient 3 for example: the two datasets match one-on-one in the original order per observation until the medical visit dataset runs out of observations and carries over the last record through the rest of the merging with the lab data. patid vid visdate vistype labid labdate pcs mcs JAN JAN JAN FEB APR MAR APR APR APR MAY By using PROC SQL, the code presented below demonstrates the Cartesian product via a JOIN-ON clause. JOIN allows us to see all the possible combinations which satisfy the ON expression between two source tables VISIT01 and LAB01 (more details about different types of JOIN can be found in the recommended reading.) Here, the asterisk (*) after SELECT selects all the variables from each dataset. The QUIT statement then turns off the SQL facility at the end. Note that the datasets do not need to be sorted beforehand. proc sql create table temp01a as select * from visit01 join lab01 on visit01.patid = lab01.patid Observe the differences between the listings produced using a MERGE-BY statement versus PROC SQL. TEMP01A now has 15 rows for patient 3 due to the merger of 3 records from VISIT01 with each of the 5 records from LAB01. patid vid visdate vistype labid labdate pcs mcs JAN JAN JAN JAN APR JAN JAN FEB JAN FEB APR FEB JAN MAR JAN MAR APR MAR JAN APR JAN APR APR APR JAN MAY JAN MAY APR MAY ALTERNATIVE SYNTAX Another way to perform a many-to-many merge is through a comma separated list and a WHERE statement. This works in the specific case when you want each record in one dataset merged to each record in another dataset (restricted only by the WHERE clause.) However, this syntax many not work for more complex joins. proc sql create table temp01b as select * from visit01, lab01 where visit01.patid = lab01.patid 3

4 A short temporary nickname could also be given in a FROM clause using the keyword AS after the actual dataset name. This is especially useful in later demonstrations for simplifying the code. proc sql create table temp02 as select * from visit01 as v, lab01 as l where v.patid = l.patid Notice here SQL table TEMP01A, TEMP01B, and TEMP02 are identical. KEEPING ONLY CERTAIN VARIABLES One method to limit our variables in our final table is through the SELECT clause. Namely, use the dataset name followed by the variable of interest. Using a nickname here eliminates the number of keystrokes. proc sql create table temp03 as select v.patid, v.visdate, l.patid, l.labdate, l.mcs, l.pcs from visit01 as v, lab01 as l where v.patid = l.patid REMAINING STEPS Adding another restriction in the WHERE clause instructs SAS to keep the rows only if visit dates and lab dates are within 5 days of each other. This restriction can also be applied in a dataset after creating TEMP03 however, it is more efficient using PROC SQL. proc sql create table temp04 as select v.patid, v.visdate, l.patid, l.labdate, l.mcs, l.pcs from visit01 as v, lab01 as l where (v.patid = l.patid) and ( abs(l.labdate - v.visdate) <= 5) The code produces the following TEMP04 table: patid labdate visdate mcs pcs 1 15JAN JAN FEB FEB MAR MAR MAR MAR APR APR JAN JAN FEB FEB MAR MAR MAR MAR JAN JAN JAN JAN APR APR FEB FEB MAR MAR APR APR

5 4 15APR APR MAY MAY JAN JAN FEB FEB FEB FEB MAR MAR MAR MAR APR APR APR APR MAY MAY Finally, we come to our last step to find the closest visit date to the lab date. The steps below ensure that we take the visit date prior to the lab date if there is a tie. data temp05 set temp04 datediff = visdate-labdate datediff_abs = abs(datediff) proc sort data=temp05 out=temp05_s by patid labdate datediff_abs datediff data temp06 set temp05_s by patid labdate datediff_abs datediff if first.labdate The resulting listing for TEMP06 should look like the following. datediff_ patid labdate visdate abs datediff mcs pcs 1 15JAN JAN FEB FEB MAR MAR APR APR JAN JAN FEB FEB MAR MAR JAN JAN APR APR FEB FEB MAR MAR APR APR MAY MAY JAN JAN FEB FEB MAR MAR APR APR MAY MAY CONCLUSION When it comes to combining data sources, the MERGE-BY statement and PROC SQL joins are very different and are viewed as two alternatives. The MERGE method was designed to manipulate sorted datasets. It basically matches records one-to-one. On the other hand, PROC SQL was designed to return a result table from non-sorted data with an all-to-all record match. The ability of PROC SQL to create Cartesian products and its simplicity of coding makes it preferable in some cases as a stepping stone to a more meaningful result. Accordingly, this paper serves as an introduction to familiarize the programmer with the basic SQL syntax to perform a many-to-many merge. ACKNOWLEDGMENTS 5

6 Many thanks to Sarah Short and George Sen for reviewing drafts of this paper. RECOMMENDED READING SAS Institute Inc., SAS 9.1 SQL Procedure User s Guide, Cary, NC: SAS Institute Inc., CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the authors at: Ginny P. Lai ICON Clinical Research 188 Embarcadero, Suite 200 San Francisco, CA Work Phone: (415) ginny.lai@iconplc.com Web: Eric Elkin ICON Clinical Research 188 Embarcadero, Suite 200 San Francisco, CA Work Phone: (415) eric.elkin@iconplc.com Web: 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 countries. indicates USA registration. Other brand and product names are trademarks of their respective companies. 6

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

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

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

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

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

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

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

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

Database Design Strategies in CANDAs Sunil Kumar Gupta Gupta Programming, Simi Valley, CA

Database Design Strategies in CANDAs Sunil Kumar Gupta Gupta Programming, Simi Valley, CA Database Design Strategies in CANDAs Sunil Kumar Gupta Gupta Programming, Simi Valley, CA ABSTRACT Developing a productive CANDA system starts with an optimal database design. Traditional objectives and

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

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

Salary. Cumulative Frequency

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

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

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

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

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

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

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

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

Counting the Ways to Count in SAS. Imelda C. Go, South Carolina Department of Education, Columbia, SC

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.

More information

A Many to Many Merge, Without SQL? Paper TU05

A Many to Many Merge, Without SQL? Paper TU05 A Many to Many Merge, Without SQL? Paper TU05 David Franklin Independent SAS Consultant TheProgrammersCabin.com While you are waiting, some trivia. The first U.S. Transcontinental Flight took 84 days,

More information

LOCF-Different Approaches, Same Results Using LAG Function, RETAIN Statement, and ARRAY Facility Iuliana Barbalau, ClinOps LLC. San Francisco, CA.

LOCF-Different Approaches, Same Results Using LAG Function, RETAIN Statement, and ARRAY Facility Iuliana Barbalau, ClinOps LLC. San Francisco, CA. LOCF-Different Approaches, Same Results Using LAG Function, RETAIN Statement, and ARRAY Facility Iuliana Barbalau, ClinOps LLC. San Francisco, CA. ABSTRACT LOCF stands for Last Observation Carried Forward

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

Oh No, a Zero Row: 5 Ways to Summarize Absolutely Nothing

Oh No, a Zero Row: 5 Ways to Summarize Absolutely Nothing Paper CC22 Oh No, a Zero Row: 5 Ways to Summarize Absolutely Nothing Stacey D. Phillips, i3 Statprobe, San Diego, CA Gary Klein, i3 Statprobe, San Diego, CA ABSTRACT SAS is wonderful at summarizing our

More information

Data-driven Validation Rules: Custom Data Validation Without Custom Programming Don Hopkins, Ursa Logic Corporation, Durham, NC

Data-driven Validation Rules: Custom Data Validation Without Custom Programming Don Hopkins, Ursa Logic Corporation, Durham, NC Data-driven Validation Rules: Custom Data Validation Without Custom Programming Don Hopkins, Ursa Logic Corporation, Durham, NC ABSTRACT One of the most expensive and time-consuming aspects of data management

More information

Data Mining Commonly Used SQL Statements

Data Mining Commonly Used SQL Statements Description: Guide to some commonly used SQL OS Requirement: Win 2000 Pro/Server, XP Pro, Server 2003 General Requirement: You will need a Relational Database (SQL server, MSDE, Access, Oracle, etc), Installation

More information

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

Table 1. Demog. id education B002 5 b003 8 b005 5 b007 9 b008 7 b009 8 b010 8 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

More information

Preserving Line Breaks When Exporting to Excel Nelson Lee, Genentech, South San Francisco, CA

Preserving Line Breaks When Exporting to Excel Nelson Lee, Genentech, South San Francisco, CA PharmaSUG 2014 Paper CC07 Preserving Line Breaks When Exporting to Excel Nelson Lee, Genentech, South San Francisco, CA ABSTRACT Do you have imported data with line breaks and want to export the data to

More information

ABSTRACT INTRODUCTION THE MAPPING FILE GENERAL INFORMATION

ABSTRACT INTRODUCTION THE MAPPING FILE GENERAL INFORMATION An Excel Framework to Convert Clinical Data to CDISC SDTM Leveraging SAS Technology Ale Gicqueau, Clinovo, Sunnyvale, CA Marc Desgrousilliers, Clinovo, Sunnyvale, CA ABSTRACT CDISC SDTM data is the standard

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

Essential Project Management Reports in Clinical Development Nalin Tikoo, BioMarin Pharmaceutical Inc., Novato, CA

Essential Project Management Reports in Clinical Development Nalin Tikoo, BioMarin Pharmaceutical Inc., Novato, CA Essential Project Management Reports in Clinical Development Nalin Tikoo, BioMarin Pharmaceutical Inc., Novato, CA ABSTRACT Throughout the course of a clinical trial the Statistical Programming group is

More information

Using the Magical Keyword "INTO:" in PROC SQL

Using the Magical Keyword INTO: in PROC SQL Using the Magical Keyword "INTO:" in PROC SQL Thiru Satchi Blue Cross and Blue Shield of Massachusetts, Boston, Massachusetts Abstract INTO: host-variable in PROC SQL is a powerful tool. It simplifies

More information

Anyone Can Learn PROC TABULATE

Anyone Can Learn PROC TABULATE Paper 60-27 Anyone Can Learn PROC TABULATE Lauren Haworth, Genentech, Inc., South San Francisco, CA ABSTRACT SAS Software provides hundreds of ways you can analyze your data. You can use the DATA step

More information

Using SAS Views and SQL Views Lynn Palmer, State of California, Richmond, CA

Using SAS Views and SQL Views Lynn Palmer, State of California, Richmond, CA Using SAS Views and SQL Views Lynn Palmer, State of Califnia, Richmond, CA ABSTRACT Views are a way of simplifying access to your ganization s database while maintaining security. With new and easier ways

More information

The Query Builder: The Swiss Army Knife of SAS Enterprise Guide

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

More information

Analysis One Code Desc. Transaction Amount. Fiscal Period

Analysis One Code Desc. Transaction Amount. Fiscal Period Analysis One Code Desc Transaction Amount Fiscal Period 57.63 Oct-12 12.13 Oct-12-38.90 Oct-12-773.00 Oct-12-800.00 Oct-12-187.00 Oct-12-82.00 Oct-12-82.00 Oct-12-110.00 Oct-12-1115.25 Oct-12-71.00 Oct-12-41.00

More information

Diving into SAS Software with the SQL Procedure Kirk Paul Lafler, Software Intelligence Corporatron

Diving into SAS Software with the SQL Procedure Kirk Paul Lafler, Software Intelligence Corporatron Diving into SAS Software with the SQL Procedure Kirk Paul Lafler, Software ntelligence Corporatron ABSTRACT Joining two or more tables of data is a powerful feature found in the relational model and the

More information

Conditional Processing Using the Case Expression in PROC SQL Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California

Conditional Processing Using the Case Expression in PROC SQL Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Conditional Processing Using the Case Expression in PROC SQL Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Abstract The SQL procedure supports conditionally selecting result

More information

WORKING WITH SUBQUERY IN THE SQL PROCEDURE

WORKING WITH SUBQUERY IN THE SQL PROCEDURE WORKING WITH SUBQUERY IN THE SQL PROCEDURE Lei Zhang, Domain Solutions Corp., Cambridge, MA Danbo Yi, Abt Associates, Cambridge, MA ABSTRACT Proc SQL is a major contribution to the SAS /BASE system. One

More information

PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL

PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL PharmaSUG 2015 - Paper QT06 PROC SQL for SQL Die-hards Jessica Bennett, Advance America, Spartanburg, SC Barbara Ross, Flexshopper LLC, Boca Raton, FL ABSTRACT Inspired by Christianna William s paper on

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

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

Improving Maintenance and Performance of SQL queries

Improving Maintenance and Performance of SQL queries PaperCC06 Improving Maintenance and Performance of SQL queries Bas van Bakel, OCS Consulting, Rosmalen, The Netherlands Rick Pagie, OCS Consulting, Rosmalen, The Netherlands ABSTRACT Almost all programmers

More information

Calculating Changes and Differences Using PROC SQL With Clinical Data Examples

Calculating Changes and Differences Using PROC SQL With Clinical Data Examples Calculating Changes and Differences Using PROC SQL With Clinical Data Examples Chang Y. Chung, Princeton University, Princeton, NJ Lei Zhang, Celgene Corporation, Summit, NJ ABSTRACT It is very common

More information

PharmaSUG 2015 - Paper QT26

PharmaSUG 2015 - Paper QT26 PharmaSUG 2015 - Paper QT26 Keyboard Macros - The most magical tool you may have never heard of - You will never program the same again (It's that amazing!) Steven Black, Agility-Clinical Inc., Carlsbad,

More information

Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA

Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA Efficient Techniques and Tips in Handling Large Datasets Shilong Kuang, Kelley Blue Book Inc., Irvine, CA ABSTRACT When we work on millions of records, with hundreds of variables, it is crucial how we

More information

Guido s Guide to PROC FREQ A Tutorial for Beginners Using the SAS System Joseph J. Guido, University of Rochester Medical Center, Rochester, NY

Guido s Guide to PROC FREQ A Tutorial for Beginners Using the SAS System Joseph J. Guido, University of Rochester Medical Center, Rochester, NY Guido s Guide to PROC FREQ A Tutorial for Beginners Using the SAS System Joseph J. Guido, University of Rochester Medical Center, Rochester, NY ABSTRACT PROC FREQ is an essential procedure within BASE

More information

A SAS Database Search Engine Gives Everyone the Power to Know Eugene Yeh, PharmaNet Inc., Cary, NC

A SAS Database Search Engine Gives Everyone the Power to Know Eugene Yeh, PharmaNet Inc., Cary, NC Paper 019-29 A SAS Database Search Engine Gives Everyone the Power to Know Eugene Yeh, PharmaNet Inc., Cary, NC ABSTRACT This application finds the matches to a search parameter that you specify from the

More information

Programming Tricks For Reducing Storage And Work Space Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA.

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

More information

THE POWER OF PROC FORMAT

THE POWER OF PROC FORMAT THE POWER OF PROC FORMAT Jonas V. Bilenas, Chase Manhattan Bank, New York, NY ABSTRACT The FORMAT procedure in SAS is a very powerful and productive tool. Yet many beginning programmers rarely make use

More information

Producing Structured Clinical Trial Reports Using SAS: A Company Solution

Producing Structured Clinical Trial Reports Using SAS: A Company Solution Producing Structured Clinical Trial Reports Using SAS: A Company Solution By Andy Lawton, Helen Dewberry and Michael Pearce, Boehringer Ingelheim UK Ltd INTRODUCTION Boehringer Ingelheim (BI), like all

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

Switching from PC SAS to SAS Enterprise Guide Zhengxin (Cindy) Yang, inventiv Health Clinical, Princeton, NJ

Switching from PC SAS to SAS Enterprise Guide Zhengxin (Cindy) Yang, inventiv Health Clinical, Princeton, NJ PharmaSUG 2014 PO10 Switching from PC SAS to SAS Enterprise Guide Zhengxin (Cindy) Yang, inventiv Health Clinical, Princeton, NJ ABSTRACT As more and more organizations adapt to the SAS Enterprise Guide,

More information

Taming the PROC TRANSPOSE

Taming the PROC TRANSPOSE Taming the PROC TRANSPOSE Matt Taylor, Carolina Analytical Consulting, LLC ABSTRACT The PROC TRANSPOSE is often misunderstood and seldom used. SAS users are unsure of the results it will give and curious

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

Remove Voided Claims for Insurance Data Qiling Shi

Remove Voided Claims for Insurance Data Qiling Shi Remove Voided Claims for Insurance Data Qiling Shi ABSTRACT The purpose of this study is to remove voided claims for insurance claim data using SAS. Suppose that for these voided claims, we don t have

More information

Converting Electronic Medical Records Data into Practical Analysis Dataset

Converting Electronic Medical Records Data into Practical Analysis Dataset Converting Electronic Medical Records Data into Practical Analysis Dataset Irena S. Cenzer, University of California San Francisco, San Francisco, CA Mladen Stijacic, San Diego, CA See J. Lee, University

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

SAS Enterprise Guide A Quick Overview of Developing, Creating, and Successfully Delivering a Simple Project

SAS Enterprise Guide A Quick Overview of Developing, Creating, and Successfully Delivering a Simple Project Paper 156-29 SAS Enterprise Guide A Quick Overview of Developing, Creating, and Successfully Delivering a Simple Project Ajaz (A.J.) Farooqi, Walt Disney Parks and Resorts, Lake Buena Vista, FL ABSTRACT

More information

EXST SAS Lab Lab #4: Data input and dataset modifications

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

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

Managing very large EXCEL files using the XLS engine John H. Adams, Boehringer Ingelheim Pharmaceutical, Inc., Ridgefield, CT

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,

More information

Instant Interactive SAS Log Window Analyzer

Instant Interactive SAS Log Window Analyzer ABSTRACT Paper 10240-2016 Instant Interactive SAS Log Window Analyzer Palanisamy Mohan, ICON Clinical Research India Pvt Ltd Amarnath Vijayarangan, Emmes Services Pvt Ltd, India An interactive SAS environment

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

SAS/Data Integration Studio Creating and Using A Generated Transformation Jeff Dyson, Financial Risk Group, Cary, NC

SAS/Data Integration Studio Creating and Using A Generated Transformation Jeff Dyson, Financial Risk Group, Cary, NC Paper BB-05 SAS/Data Integration Studio Creating and Using A Generated Transformation Jeff Dyson, Financial Risk Group, Cary, NC ABSTRACT SAS/Data Integration Studio (DI Studio) transformations are packaged

More information

Infographics in the Classroom: Using Data Visualization to Engage in Scientific Practices

Infographics in the Classroom: Using Data Visualization to Engage in Scientific Practices Infographics in the Classroom: Using Data Visualization to Engage in Scientific Practices Activity 4: Graphing and Interpreting Data In Activity 4, the class will compare different ways to graph the exact

More information

A Closer Look at PROC SQL s FEEDBACK Option Kenneth W. Borowiak, PPD, Inc., Morrisville, NC

A Closer Look at PROC SQL s FEEDBACK Option Kenneth W. Borowiak, PPD, Inc., Morrisville, NC A Closer Look at PROC SQL s FEEDBACK Option Kenneth W. Borowiak, PPD, Inc., Morrisville, NC SESUG 2012 ABSTRACT The FEEDBACK option on the PROC SQL statement controls whether an expanded or transformed

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

A Gentle Introduction to Hash Tables. Kevin Martin, Kevin.Martin2@va.gov Dept. of Veteran Affairs July 15, 2009

A Gentle Introduction to Hash Tables. Kevin Martin, Kevin.Martin2@va.gov Dept. of Veteran Affairs July 15, 2009 A Gentle Introduction to Hash Tables Kevin Martin, Kevin.Martin2@va.gov Dept. of Veteran Affairs July 15, 2009 ABSTRACT Most SAS programmers fall into two categories. Either they ve never heard of hash

More information

Your Database Can Do SAS Too!

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

More information

AN INTRODUCTION TO THE SQL PROCEDURE Chris Yindra, C. Y. Associates

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

More information

Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC

Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC ABSTRACT PharmaSUG 2013 - Paper CC11 Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC There are different methods such PROC

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

Encoding the Password

Encoding the Password SESUG 2012 Paper CT-28 Encoding the Password A low maintenance way to secure your data access Leanne Tang, National Agriculture Statistics Services USDA, Washington DC ABSTRACT When users access data in

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

Training/Internship Brochure Advanced Clinical SAS Programming Full Time 6 months Program

Training/Internship Brochure Advanced Clinical SAS Programming Full Time 6 months Program Training/Internship Brochure Advanced Clinical SAS Programming Full Time 6 months Program Domain Clinical Data Sciences Private Limited 8-2-611/1/2, Road No 11, Banjara Hills, Hyderabad Andhra Pradesh

More information

Lecture 4: SQL Joins. Morgan C. Wang Department of Statistics University of Central Florida

Lecture 4: SQL Joins. Morgan C. Wang Department of Statistics University of Central Florida Lecture 4: SQL Joins Morgan C. Wang Department of Statistics University of Central Florida 1 Outline 4.1 Introduction to SQL Joins 4.2 Complex SQL Joins 2 Outline 4.1 Introduction to SQL Joins 4.2 Complex

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

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

Katie Minten Ronk, Steve First, David Beam Systems Seminar Consultants, Inc., Madison, WI

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

More information

Relational Division and SQL

Relational Division and SQL Relational Division and SQL Soulé 1 Example Relations and Queries As a motivating example, consider the following two relations: Taken(,Course) which contains the courses that each student has completed,

More information

CA IDMS. Database Design Guide. Release 18.5.00, 2nd Edition

CA IDMS. Database Design Guide. Release 18.5.00, 2nd Edition CA IDMS Database Design Guide Release 18.5.00, 2nd Edition This Documentation, which includes embedded help systems and electronically distributed materials, (hereinafter referred to as the Documentation

More information

Parallel Data Preparation with the DS2 Programming Language

Parallel Data Preparation with the DS2 Programming Language ABSTRACT Paper SAS329-2014 Parallel Data Preparation with the DS2 Programming Language Jason Secosky and Robert Ray, SAS Institute Inc., Cary, NC and Greg Otto, Teradata Corporation, Dayton, OH A time-consuming

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

Your Database Can Do SAS Too!

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

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

PharmaSUG2011 - Paper AD11

PharmaSUG2011 - Paper AD11 PharmaSUG2011 - Paper AD11 Let the system do the work! Automate your SAS code execution on UNIX and Windows platforms Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.,

More information

Crossing the environment chasm - better queries between SAS and DB2 Mark Sanderson, CIGNA Corporation, Bloomfield, CT

Crossing the environment chasm - better queries between SAS and DB2 Mark Sanderson, CIGNA Corporation, Bloomfield, CT Crossing the environment chasm - better queries between SAS and DB2 Mark Sanderson, CIGNA Corporation, Bloomfield, CT ABSTRACT The source data used by many SAS programmers resides within non-sas relational

More information

Introduction to Proc SQL Katie Minten Ronk, Systems Seminar Consultants, Madison, WI

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

More information

Guide to Performance and Tuning: Query Performance and Sampled Selectivity

Guide to Performance and Tuning: Query Performance and Sampled Selectivity Guide to Performance and Tuning: Query Performance and Sampled Selectivity A feature of Oracle Rdb By Claude Proteau Oracle Rdb Relational Technology Group Oracle Corporation 1 Oracle Rdb Journal Sampled

More information

DATA CLEANING: LONGITUDINAL STUDY CROSS-VISIT CHECKS

DATA CLEANING: LONGITUDINAL STUDY CROSS-VISIT CHECKS Paper 1314-2014 ABSTRACT DATA CLEANING: LONGITUDINAL STUDY CROSS-VISIT CHECKS Lauren Parlett,PhD Johns Hopkins University Bloomberg School of Public Health, Baltimore, MD Cross-visit checks are a vital

More information

PROC SUMMARY Options Beyond the Basics Susmita Pattnaik, PPD Inc, Morrisville, NC

PROC SUMMARY Options Beyond the Basics Susmita Pattnaik, PPD Inc, Morrisville, NC Paper BB-12 PROC SUMMARY Options Beyond the Basics Susmita Pattnaik, PPD Inc, Morrisville, NC ABSTRACT PROC SUMMARY is used for summarizing the data across all observations and is familiar to most SAS

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

The HPSUMMARY Procedure: An Old Friend s Younger (and Brawnier) Cousin Anh P. Kellermann, Jeffrey D. Kromrey University of South Florida, Tampa, FL

The HPSUMMARY Procedure: An Old Friend s Younger (and Brawnier) Cousin Anh P. Kellermann, Jeffrey D. Kromrey University of South Florida, Tampa, FL Paper 88-216 The HPSUMMARY Procedure: An Old Friend s Younger (and Brawnier) Cousin Anh P. Kellermann, Jeffrey D. Kromrey University of South Florida, Tampa, FL ABSTRACT The HPSUMMARY procedure provides

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

The entire SAS code for the %CHK_MISSING macro is in the Appendix. The full macro specification is listed as follows: %chk_missing(indsn=, outdsn= );

The entire SAS code for the %CHK_MISSING macro is in the Appendix. The full macro specification is listed as follows: %chk_missing(indsn=, outdsn= ); Macro Tabulating Missing Values, Leveraging SAS PROC CONTENTS Adam Chow, Health Economics Resource Center (HERC) VA Palo Alto Health Care System Department of Veterans Affairs (Menlo Park, CA) Abstract

More information

Paper FF-014. Tips for Moving to SAS Enterprise Guide on Unix Patricia Hettinger, Consultant, Oak Brook, IL

Paper FF-014. Tips for Moving to SAS Enterprise Guide on Unix Patricia Hettinger, Consultant, Oak Brook, IL Paper FF-014 Tips for Moving to SAS Enterprise Guide on Unix Patricia Hettinger, Consultant, Oak Brook, IL ABSTRACT Many companies are moving to SAS Enterprise Guide, often with just a Unix server. A surprising

More information