SQL Case Expression: An Alternative to DATA Step IF/THEN Statements
|
|
- Homer Bailey
- 8 years ago
- Views:
Transcription
1 SQL Case Expression: An Alternative to DATA Step IF/THEN Statements John Q. Zhang LCS Industries, Inc. Clifton NJ ABSTRACT This paper will show that case-expression utilized in PROC SQL can be as efficient and flexible as the logical expression IF/THEN statement. In addition to the advantage of clear, brief code, PROC SQL can not only perform procedural steps but data steps as well. This paper will show how powerful a tool PROC SQL can be. INTRODUCTION Quite a few papers presented in the previous conferences and current one have elaborated the fundamentals of SAS SQL procedure; the syntax like CREATE, SELECT *, FROM, GROUP BY, ORDER BY, WHERE, INTERSECT, UNION, EXCEPT, EXISTS, INSERT and COALESCE function become more and more familiar to the programmers and users. It is not premature, definitely, to further exploit the potential and capacity of PROC SQL with the objective of benefiting the SAS data processing community. The paper represents one attempt at this exploitation. RATIONALE The SQL CASE expression normally is composed of case-operand, when-condition and resultexpression. They must be valid sql-expressions. The syntax format goes like the following: CASE<case-operand> WHEN when condition THEN result-expression <WHEN when-condition THEN result-expression>... <ELSE result-expression> END. Multiple Nested CASE expression can also be used correspondingly to nested IF/THEN statement: CASE<case-operand> WHEN when condition THEN( CASE<case-operand> WHEN when condition THEN( result-expression) <ELSE(result-expression)> END) <ELSE(result-expression)> END. Three versions are available of the SAS secondorder program (also called program generator ). Two 1 versions are compiled by the base SAS DATA step, with very little PROC SQL involved, while the third version quite heavily leaned on PROC SQL (the complete program presented in APPENDIX III). The function of the programs is using SAS to read COBOL copybooks (layouts)to create SAS programs which are able to create SAS data sets ready for further manipulation and analysis. Some of the copybooks are longer than 500 lines. It would be considerably timeconsuming, tedious and error-prone to manually put in the input statement, start position, variable names, variable length and label statement, etc. Those programs can take care of the problems and produce exactly the same output in a few seconds. To set up the input statement (a sample of a copybook can be found in APPENDIX I)copybooks have to be cut in 2 parts: the description part (called dummy or dummy1 in the program generator); and the length part (called code ). To create the variables using the description part sequence numbers have to be concatenated with character strings to avoid duplicates. After the variables are created they can be concatenated with the description part itself to set up label statement. To set up the length of the variables data transformation and manipulation of the length part of the copybook are necessary, which is the major component of the first 2 versions of the program generator, and where IF/THEN statements or PROC SQL is heavily involved. The basic operation is to take the number of the bytes that the each variable occupies and express them as SAS informats. After the length of variables is set up, the program can calculate the starting position of the variables. First pick just the number (of bytes)in the length, then sum the number for each variable using the LAG function. The first program uses IF/THEN statements in SAS DATA step to assign SAS informats to the length of variables created, i.e. to change COBOL notation to SAS notation. The CASE expression, specially the nested CASE WHEN condition, supported in PROC SQL is
2 introduced in the second program to handle the same task. The rest of the program is quite similar to the first one. In APPENDIX IV part of the first program (IF/THEN statements to set up length)is presented to compare with the CASE expression utilized in the second program. The third program also uses DATA step statements to manipulate the description part of the copybook and the starting position of SAS variables as well. But the PROC FORMAT procedure is used to create SAS informats assigned to the variables established. The first program looks lengthier and more redundant than the second as well as the third. The third one works as well as the other two, and it is concise and brief but a user-defined format, created by a SAS macro, must be stored in a SAS catalog library. CONCLUSION After running the second program it can be seen that the CASE expression of PROC SQL may completely take the place of IF/THEN statements and result in the same output(provided in APPENDIX II). It is more efficient in terms of CPU time used. The code would be more brief and concise combined with in-line views. Therefore, another alternative to IF/THEN statements would be available whenever a particular situation fits. SAS users would be better armed in terms of choice of techniques. It also shows the versatility of PROC SQL. This paper does not intend to prove that PROC SQL, especially the CASE expression, leaves nothing to be desired in comparison with IF/THEN statements in regular DATA step. In fact, it does have some disadvantages. For instance, if the situation is a multiple condition with a single result CASE expressions would work as well as IF/THEN statements, and the code even briefer. This is what the 2nd program shows. However, in the case of a single condition with multiple result the CASE expression would appear lengthy and clumsy, even though the output would be the same, for example, THEN(2) END AS B, CASE WHEN(A=1) THEN(3) END AS C, CASE WHEN(A=1) THEN(4) END AS D... The repetitive CASE WHEN condition makes the code look awkward. Secondly, some useful SAS functions and operators are not supported in PROC SQL, definitely not in CASE expression, such as the family of LAG functions. Note: this paper is just a experiment that attempts to exploit and expand the capacity of PROC SQL. Any comments, suggestions and advice would certainly be welcome. With respect to the application, the program generators can be modified to read any flat file of layouts, either in COBOL or in other languages, which could readily facilitate SAS data step programming and analysis. The program generators appended to the paper could set up the SAS programs that read only the fixedlength-portion of COBOL files, in consideration of space. Those for reading both fixed and variable-length-portion COBOL files are also available but they become lengthier and more complex. ACKNOWLEDGMENTS SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. indicates USA registration. Thanks for the advice and information from Mr. Bernard F. Kaine & Mr. Harold B. Legg. CONTACT INFORMATION John Q. Zhang addr: jzhang@lcsi.com (201) /EXT3486(O) (212) (H) IF A=1 THEN DO; B=2; C=3; D=4; ; For PROC SQL, the code would be like the following: CASE WHEN(A=1) 2
3 APPENDIX I: SAMPLE OF COBOL COPYBOOK *********************************************************** 96/08/30 * CPXXXXXX * XXXXXXX STANDARDIZATION RECORD LAYOUT * LV009 *********************************************************** * DPFF-FIELDS = STANDARDIZED RETURN FIELDS * IN-FIELDS = ORIGINAL DATA PLUS COMPLETE NAME FIELD * PERS-FIELDS = PERSONS OUTPUT *********************************************************** * PROJECT * 01 DPFF-SITE-RECORD. 03 DPFF-REC-LENGTH PIC X(05). 03 DPFF-ORIGINAL-LIST PIC X(03). 03 DPFF-SEQUENCE PIC X(08). 03 DPFF-STD-ADDRESS. 05 DPFF-TITLE PIC X(25). 05 DPFF-ADDRESS1 PIC X(10). 05 DPFF-ADDRESS2 PIC X(20). 05 DPFF-POST-CODE PIC X(08). 05 DPFF-COUNTRY PIC X(25). 07 PERS-GEOCODE PIC X(12). 07 PERS-GEOCODE-LEVEL PIC X(05). 07 PERS-STREET-KEY PIC X(05). 07 PERS-SEX-CODE PIC X(01). 03 DPFF-TOWN-POSITION PIC S9(09) COMP DPFF-TITLE-LENGTH PIC 9(02). 03 DPFF-TITLE-LENGTH2 PIC 9(04). 03 DPFF-TV-AREA-CODE PIC 9(04) COMP. 03 DPFF-PREMIS-POSITION PIC 9(08) COMP. 03 FILLER PIC X(45). 03 DPFF-CREATION-DATE PIC 9(06) COMP DPFF-THOROUGHFARE-POS PIC 9(03)V9 COMP DPFF-MAJOR-THORFR-POS PIC 9(03)V99 COMP DPFF-DEC-POSITION PIC S9(07)V999 COMP DPFF-COMPANY-INDICATOR PIC X(04). 03 DPFF-PRIVATE-ADDR-IND PIC X(04). 03 DPFF-FLAT-KEY PIC X(02). 03 DPFF-POSTCODE-DPS PIC X(02). 03 DPFF-LIST-CODES PIC X(10). 03 IN-ORIGINAL-RECORD. 05 IN-CESSATION-REASON PIC X(02). 05 IN-EXCHANGE-CODE PIC X(06). 05 IN-INSTALLATION-STATUS PIC X(01). 05 IN-CUSTOMER-CLASS PIC X(01). 05 IN-CUSTOMER-TYPE PIC X(02). 05 IN-END-DATE PIC X(08). 05 IN-START-DATE PIC X(08). 05 IN-SITE-INFO. 10 IN-TITLE PIC X(28). 10 IN-INITIALS PIC X(28). 05 IN-POSTCODE PIC X(10). 03 FILLER PIC X(1808). APPENDIX II: OUTPUT DATA XXXX; INFILE YYYY; RECLE14 ORIGI15 SEQUE16 TITLE18 ADDRE19 ADDRE20 POSTC21 COUNT22 GEOCO23 GEOCO24 STREE25 SEXCO26 TOWNP27 TITLE28 TITLE
4 @0139 TVARE30 PREMI31 PIB4. FILL32 $CHAR45. CREAT33 THORO34 MAJOR35 DECPO36 COMPA37 PRIVA38 FLATK39 POSTC40 LISTC41 CESSA43 EXCHA44 INSTA45 CUSTO46 CUSTO47 ENDDA48 START49 TITLE51 INITI52 POSTC53 $CHAR10. FILL54 $CHAR1808.*/ ; LABEL RECLE14="REC LENGTH" ORIGI15="ORIGINAL LIST" SEQUE16="SEQUENCE" TITLE18="TITLE" ADDRE19="ADDRESS1" ADDRE20="ADDRESS2" POSTC21="POST CODE" COUNT22="COUNTRY" GEOCO23="GEOCODE" GEOCO24="GEOCODE LEVEL" STREE25="STREET KEY" SEXCO26="SEX CODE" TOWNP27="TOWN POSITION" TITLE28="TITLE LENGTH" TITLE29="TITLE LENGTH2" TVARE30="TV AREA CODE" PREMI31="PREMIS POSITION" CREAT33="CREATION DATE" THORO34="THOROUGHFARE POS" MAJOR35="MAJOR THORFR POS" DECPO36="DEC POSITION" COMPA37="COMPANY INDICATOR" PRIVA38="PRIVATE ADDR IND" FLATK39="FLAT KEY" POSTC40="POSTCODE DPS" LISTC41="LIST CODES" CESSA43="CESSATION REASON" EXCHA44="EXCHANGE CODE" INSTA45="INSTALLATION STATUS" CUSTO46="CUSTOMER CLASS" CUSTO47="CUSTOMER TYPE" ENDDA48="END DATE" START49="START DATE" TITLE51="TITLE" INITI52="INITIALS" POSTC53="POSTCODE" ; 4
5 APPENDIX III: THE 2nd PROGRAM(PROC SQL version) FILENAME X 'CPXXXXXX.SAS'; OPTIONS LS=132 MPRINT; DATA INPUT; INFILE X MISSOVER LENGTH=L; INPUT DUMMY $VARYING68. L; DUMMY=TRANSLATE(DUMMY,' ','-'); PIC=INDEXW(DUMMY,'PIC'); SEQ=_N_; IF PIC THEN DO; DUMMY1=SUBSTR(DUMMY,1,PIC-1); CODE=SUBSTR(DUMMY,PIC,INDEX(DUMMY,'.')-PIC+1); ELSE DELETE; FILL=INDEXW(DUMMY,'FILLER'); L1=INDEX(CODE,'('); L2=INDEX(CODE,')'); X=INDEX(CODE,'X('); T9=INDEX(CODE,'9('); T=INDEX(CODE,'3.'); V=INDEX(CODE,'V'); V9=INDEX(CODE,'V9'); V99=INDEX(CODE,'V99'); V999=INDEX(CODE,'V999'); COMP=INDEX(CODE,'COMP'); IF PIC & FILL=0 & INDEXC(DUMMY,' ') THEN WORD=SCAN(DUMMY,2); PROC SQL; CREATE VIEW PICK AS SELECT UNIQUE WORD FROM INPUT WHERE WORD NE ' '; DATA _NULL_; SET PICK; S+1; CALL SYMPUT('SYS' LEFT(PUT(S,2.)),TRIM(LEFT(WORD))); CALL SYMPUT('CON',PUT(S,2.)); %MACRO SRCH1; %DO J=1 %TO &CON; Y&J=INDEX(DUMMY,"&&SYS&J"); % %M /*SET UP FIELDS, LENGTH AND LABEL*/ DATA INPUT2; SET INPUT; %SRCH1 PROC SQL; CREATE VIEW MANU AS SELECT LENG,FIELD,LENGTH,TRIM(FIELD) '=' '"' TRIM(LEFT(DSCRPTN)) '"' AS LABEL FROM( SELECT CASE WHEN(INDEX(LENGTH,'.')) THEN(COMPRESS(SUBSTR(LENGTH,1,INDEX(LENGTH,'.')-1),'$CHARPIBD.')) ELSE(LENGTH) END AS LENG, FIELD, LENGTH FROM( SELECT CASE %MACRO SRCH2; %DO K=1 %TO &CON; WHEN(Y&K AND LENGTH(COMPRESS(DUMMY1))>=5) THEN(SUBSTR(COMPRESS(SUBSTR(DUMMY1,Y&K+LENGTH("&&SYS&K"))),1,5) LEFT(PUT(SEQ,3.))) WHEN(Y&K AND LENGTH(COMPRESS(DUMMY1))<5) THEN(COMPRESS(DUMMY1) LEFT(PUT(SEQ,3.))) % %M %SRCH2 WHEN(FILL) THEN(SUBSTR(DUMMY1,FILL,4) LEFT(PUT(SEQ,3.))) ELSE(DUMMY1) END AS FIELD, CASE %MACRO SRCH3; %DO L=1 %TO &CON; WHEN(Y&L) 5
6 THEN(SUBSTR(DUMMY1,Y&L+LENGTH("&&SYS&L"),PIC-Y&L-LENGTH("&&SYS&L"))) % %M %SRCH3 ELSE(DUMMY1) END AS DSCRPTN, CASE WHEN(X & T9=0) THEN(COMPRESS('$CHAR' SUBSTR(CODE,L1+1,L2-L1-1) '.')) WHEN(X=0 & COMP=0) THEN(CASE WHEN(T9) THEN(CASE WHEN(V9=0) THEN( COMPRESS(PUT(INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.),3.) '.')) WHEN(V9 & V99=0 & V999=0) THEN( COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+1),3.) '.1')) WHEN(V9 & V99 & V999=0) THEN( COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+2),3.) '.2')) WHEN(V9 & V99 & V999) THEN( COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+3),3.) '.3')) WHEN(X=0 & COMP>0) THEN(CASE WHEN(T=0 & T9) THEN( COMPRESS('PIB' PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)/2),3.) '.')) WHEN(T) THEN( CASE WHEN(T9) THEN( CASE WHEN(V9=0) THEN( COMPRESS('PD' PUT(CEIL(INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)/2),3.) '.')) WHEN(V9 & V99=0 & V999=0) THEN( COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR( CODE,L1+1,L2-L1-1),3.)+1)/2),3.) '.1')) WHEN(V9 & V99 & V999=0) THEN( COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR( CODE,L1+1,L2-L1-1),3.)+2)/2),3.) '.2')) WHEN(V9 & V99 & V999) THEN( COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR( CODE,L1+1,L2-L1-1),3.)+3)/2),3.) '.3')) ELSE(CODE) END AS LENGTH FROM INPUT2)); /* SET UP STARTING POSITIONS */ DATA START(KEEP=START FIELD LENGTH LABEL); IF _N_=1 THEN STRT=1; SET MANU; STRT+INPUT(LENG,4.); STAT=LAG(STRT); IF STAT=. THEN STAT=1; START='@' LEFT(PUT(STAT,Z4.)); /* WRITE TO A OUTPUT FILE AND MAKE A SAS PROGRAM READY */ DATA _NULL_; IF _N_=1 THEN 'DATA XXXX;' /@7 'INFILE YYYY;' /@7 'INPUT'; DO UNTIL(END1); SET START END=END1; IF FIELD ^=:'FILL' THEN LENGTH; ELSE '*/'; IF END1 THEN ';' /@7 ' ' /@7 'LABEL'; DO UNTIL(END2); SET START END=END2; IF INDEX(LABEL,'FILLER')=0 THEN LABEL; IF END2 THEN ';' /@7 ''; 6
7 APPENDIX IV: corresponding IF/THEN statements IF PIC & X THEN DO; LENGTH='$CHAR' SUBSTR(CODE,L1+1,L2-L1-1) '.'; ELSE IF PIC & X=0 THEN DO; IF COMP=0 & T=0 THEN DO; IF T9 & V=0 THEN DO; LENGTH=COMPRESS(PUT(INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.),3.) '.'); ELSE IF T9 & V THEN DO; IF V9 & V99=0 THEN DO; LENGTH=COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+1),3.) '.1'); ELSE IF V9 & V99 & V999=0 THEN DO; LENGTH=COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+2),3.) '.2'); ELSE IF V9 & V99 & V999 THEN DO; LENGTH=COMPRESS(PUT((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+3),3.) '.3'); ELSE IF COMP & T=0 THEN DO; IF T9 & V=0 THEN DO; LENGTH=COMPRESS('PIB' PUT(INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)/2,3.) '.'); ELSE IF COMP & T THEN DO; IF T9 & V=0 THEN DO; LENGTH=COMPRESS('PD' PUT((CEIL(INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)/2)),3.) '.'); ELSE IF T9 & V THEN DO; IF V9 & V99=0 THEN DO; LENGTH=COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+1)/2),3.) '.1'); ELSE IF V9 & V99 & V999=0 THEN DO; LENGTH=COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+2)/2),3.) '.2'); ELSE IF V9 & V99 & V999 THEN DO; LENGTH=COMPRESS('PD' PUT(CEIL((INPUT(SUBSTR(CODE,L1+1,L2-L1-1),3.)+3)/2),3.) '.3'); 7
Handling Missing Values in the SQL Procedure
Handling Missing Values in the SQL Procedure Danbo Yi, Abt Associates Inc., Cambridge, MA Lei Zhang, Domain Solutions Corp., Cambridge, MA ABSTRACT PROC SQL as a powerful database management tool provides
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
More informationA Method for Cleaning Clinical Trial Analysis Data Sets
A Method for Cleaning Clinical Trial Analysis Data Sets Carol R. Vaughn, Bridgewater Crossings, NJ ABSTRACT This paper presents a method for using SAS software to search SAS programs in selected directories
More informationOracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
More informationUsing 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 informationEffective 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 informationSearch and Replace in SAS Data Sets thru GUI
Search and Replace in SAS Data Sets thru GUI Edmond Cheng, Bureau of Labor Statistics, Washington, DC ABSTRACT In managing data with SAS /BASE software, performing a search and replace is not a straight
More informationOracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
More informationCHAPTER 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 informationOracle Database 12c: Introduction to SQL Ed 1.1
Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,
More informationProject Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas
Paper 197 Project Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas ABSTRACT The following paper describes a project request and tracking system that has been
More informationSAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board
SAS PROGRAM EFFICIENCY FOR BEGINNERS Bruce Gilsen, Federal Reserve Board INTRODUCTION This paper presents simple efficiency techniques that can benefit inexperienced SAS software users on all platforms.
More informationOracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
More informationSUGI 29 Coders' Corner
Paper 074-29 Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 19 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users
More informationData 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 informationDuration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
More informationApplications Development ABSTRACT PROGRAM DESIGN INTRODUCTION SAS FEATURES USED
Checking and Tracking SAS Programs Using SAS Software Keith M. Gregg, Ph.D., SCIREX Corporation, Chicago, IL Yefim Gershteyn, Ph.D., SCIREX Corporation, Chicago, IL ABSTRACT Various checks on consistency
More informationIdentifying Invalid Social Security Numbers
ABSTRACT Identifying Invalid Social Security Numbers Paulette Staum, Paul Waldron Consulting, West Nyack, NY Sally Dai, MDRC, New York, NY Do you need to check whether Social Security numbers (SSNs) are
More informationPreparing your data for analysis using SAS. Landon Sego 24 April 2003 Department of Statistics UW-Madison
Preparing your data for analysis using SAS Landon Sego 24 April 2003 Department of Statistics UW-Madison Assumptions That you have used SAS at least a few times. It doesn t matter whether you run SAS in
More informationRemove 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 informationEmailing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA
Emailing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA ABSTRACT With multiple programmers contributing to a batch
More informationA Macro to Create Data Definition Documents
A Macro to Create Data Definition Documents Aileen L. Yam, sanofi-aventis Inc., Bridgewater, NJ ABSTRACT Data Definition documents are one of the requirements for NDA submissions. This paper contains a
More informationMOC 20461C: Querying Microsoft SQL Server. Course Overview
MOC 20461C: Querying Microsoft SQL Server Course Overview This course provides students with the knowledge and skills to query Microsoft SQL Server. Students will learn about T-SQL querying, SQL Server
More informationPaper TT09 Using SAS to Send Bulk Emails With Attachments
Paper TT09 Using SAS to Send Bulk Emails With Attachments Wenjie Wang, Pro Unlimited, Bridgewater, NJ Simon Lin, Merck Research Labs, Merck & Co., Inc., Rahway, NJ ABSTRACT In the business world, using
More informationHow to Use SDTM Definition and ADaM Specifications Documents. to Facilitate SAS Programming
How to Use SDTM Definition and ADaM Specifications Documents to Facilitate SAS Programming Yan Liu Sanofi Pasteur ABSTRCT SDTM and ADaM implementation guides set strict requirements for SDTM and ADaM variable
More informationSAS Comments How Straightforward Are They? Jacksen Lou, Merck & Co.,, Blue Bell, PA 19422
SAS Comments How Straightforward Are They? Jacksen Lou, Merck & Co.,, Blue Bell, PA 19422 ABSTRACT SAS comment statements typically use conventional symbols, *, %*, /* */. Most programmers regard SAS commenting
More informationPaper 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 informationQuerying Microsoft SQL Server
Course 20461C: Querying Microsoft SQL Server Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions, tools used
More informationMore Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board
More Tales from the Help Desk: 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 informationOptimizing System Performance by Monitoring UNIX Server with SAS
Optimizing System Performance by Monitoring UNIX Server with SAS Sam Mao, Quintiles, Inc., Kansas City, MO Jay Zhou, Quintiles, Inc., Kansas City, MO ABSTRACT To optimize system performance and maximize
More informationHow to Reduce the Disk Space Required by a SAS Data Set
How to Reduce the Disk Space Required by a SAS Data Set Selvaratnam Sridharma, U.S. Census Bureau, Washington, DC ABSTRACT SAS datasets can be large and disk space can often be at a premium. In this paper,
More informationSAS UNIX-Space Analyzer A handy tool for UNIX SAS Administrators Airaha Chelvakkanthan Manickam, Cognizant Technology Solutions, Teaneck, NJ
PharmaSUG 2012 Paper PO11 SAS UNIX-Space Analyzer A handy tool for UNIX SAS Administrators Airaha Chelvakkanthan Manickam, Cognizant Technology Solutions, Teaneck, NJ ABSTRACT: In the fast growing area
More informationPaper 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 informationPharmaSUG2011 - 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 informationCourse ID#: 1401-801-14-W 35 Hrs. Course Content
Course Content Course Description: This 5-day instructor led course provides students with the technical skills required to write basic Transact- SQL queries for Microsoft SQL Server 2014. This course
More informationPROC 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 informationSQL Server Database Coding Standards and Guidelines
SQL Server Database Coding Standards and Guidelines http://www.sqlauthority.com Naming Tables: Stored Procs: Triggers: Indexes: Primary Keys: Foreign Keys: Defaults: Columns: General Rules: Rules: Pascal
More informationTable 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 informationSAS Macros as File Management Utility Programs
Paper 219-26 SAS Macros as File Management Utility Programs Christopher J. Rook, EDP Contract Services, Bala Cynwyd, PA Shi-Tao Yeh, EDP Contract Services, Bala Cynwyd, PA ABSTRACT This paper provides
More informationOverview. 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 informationDBF 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 informationOracle 10g PL/SQL Training
Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural
More informationABSTRACT INTRODUCTION IMPORTING THE DATA SESUG 2012. Paper CT-23
SESUG 2012 Paper CT-23 Introducing a New FINDIT Macro: An Efficient Tool for Simultaneously Searching Several Free-Text Fields Using Multiple Keywords LaTonia Richardson, Centers for Disease Control and
More informationAn 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 informationThe 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 informationTHE 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 informationInnovative Techniques and Tools to Detect Data Quality Problems
Paper DM05 Innovative Techniques and Tools to Detect Data Quality Problems Hong Qi and Allan Glaser Merck & Co., Inc., Upper Gwynnedd, PA ABSTRACT High quality data are essential for accurate and meaningful
More informationAN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason
More informationPerforming 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 informationCobol. By: Steven Conner. COBOL, COmmon Business Oriented Language, one of the. oldest programming languages, was designed in the last six
Cobol By: Steven Conner History: COBOL, COmmon Business Oriented Language, one of the oldest programming languages, was designed in the last six months of 1959 by the CODASYL Committee, COnference on DAta
More informationQuerying Microsoft SQL Server Course M20461 5 Day(s) 30:00 Hours
Área de formação Plataforma e Tecnologias de Informação Querying Microsoft SQL Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL
More informationOracle 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 informationFlat Pack Data: Converting and ZIPping SAS Data for Delivery
Flat Pack Data: Converting and ZIPping SAS Data for Delivery Sarah Woodruff, Westat, Rockville, MD ABSTRACT Clients or collaborators often need SAS data converted to a different format. Delivery or even
More informationAutomating SAS Macros: Run SAS Code when the Data is Available and a Target Date Reached.
Automating SAS Macros: Run SAS Code when the Data is Available and a Target Date Reached. Nitin Gupta, Tailwind Associates, Schenectady, NY ABSTRACT This paper describes a method to run discreet macro(s)
More informationEliminating Tedium by Building Applications that Use SQL Generated SAS Code Segments
Eliminating Tedium by Building Applications that Use SQL Generated SAS Code Segments David A. Mabey, Reader s Digest Association Inc., Pleasantville, NY ABSTRACT When SAS applications are driven by data-generated
More informationFiles. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?
Files What s it all about? Information being stored about anything important to the business/individual keeping the files. The simple concepts used in the operation of manual files are often a good guide
More informationThe Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD
Paper 052-29 The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT AND INTRODUCTION CALL SYMPUT is a SAS language
More informationAutomate Data Integration Processes for Pharmaceutical Data Warehouse
Paper AD01 Automate Data Integration Processes for Pharmaceutical Data Warehouse Sandy Lei, Johnson & Johnson Pharmaceutical Research and Development, L.L.C, Titusville, NJ Kwang-Shi Shu, Johnson & Johnson
More informationMOC 20461 QUERYING MICROSOFT SQL SERVER
ONE STEP AHEAD. MOC 20461 QUERYING MICROSOFT SQL SERVER Length: 5 days Level: 300 Technology: Microsoft SQL Server Delivery Method: Instructor-led (classroom) COURSE OUTLINE Module 1: Introduction to Microsoft
More informationDatabase Database Management System (DBMS)
Database Database Management System (DBMS) Introduction to databases A database is a collection of structured and related data items organized so as to provide a consistent and controlled access to items.
More informationAutomation of Large SAS Processes with Email and Text Message Notification Seva Kumar, JPMorgan Chase, Seattle, WA
Automation of Large SAS Processes with Email and Text Message Notification Seva Kumar, JPMorgan Chase, Seattle, WA ABSTRACT SAS includes powerful features in the Linux SAS server environment. While creating
More informationAN 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 informationBuilding a Customized Data Entry System with SAS/IntrNet
Building a Customized Data Entry System with SAS/IntrNet Keith J. Brown University of North Carolina General Administration Chapel Hill, NC Introduction The spread of the World Wide Web and access to the
More information# or ## - how to reference SQL server temporary tables? Xiaoqiang Wang, CHERP, Pittsburgh, PA
# or ## - how to reference SQL server temporary tables? Xiaoqiang Wang, CHERP, Pittsburgh, PA ABSTRACT This paper introduces the ways of creating temporary tables in SQL Server, also uses some examples
More informationQuerying Microsoft SQL Server 20461C; 5 days
Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc Querying Microsoft SQL Server 20461C; 5 days Course Description This 5-day
More informationSQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach
TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded
More informationMicrosoft' Excel & Access Integration
Microsoft' Excel & Access Integration with Office 2007 Michael Alexander and Geoffrey Clark J1807 ; pwiueyb Wiley Publishing, Inc. Contents About the Authors Acknowledgments Introduction Part I: Basic
More informationCA Telon Application Generator
CA Telon Application Generator IDMS Database SQL Option Guide r5.1 This documentation and any related computer software help programs (hereinafter referred to as the "Documentation") are for your informational
More informationCS 241 Data Organization Coding Standards
CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.
More informationSAS Logic Coding Made Easy Revisit User-defined Function Songtao Jiang, Boston Scientific Corporation, Marlborough, MA
ABSTRACT PharmaSUG 2013 - Paper CC04 SAS Logic Coding Made Easy Revisit User-defined Function Songtao Jiang, Boston Scientific Corporation, Marlborough, MA SAS programmers deal with programming logics
More informationIntroducing Microsoft SQL Server 2012 Getting Started with SQL Server Management Studio
Querying Microsoft SQL Server 2012 Microsoft Course 10774 This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server
More informationSAS ODS HTML + PROC Report = Fantastic Output Girish K. Narayandas, OptumInsight, Eden Prairie, MN
SA118-2014 SAS ODS HTML + PROC Report = Fantastic Output Girish K. Narayandas, OptumInsight, Eden Prairie, MN ABSTRACT ODS (Output Delivery System) is a wonderful feature in SAS to create consistent, presentable
More informationABSTRACT THE ISSUE AT HAND THE RECIPE FOR BUILDING THE SYSTEM THE TEAM REQUIREMENTS. Paper DM09-2012
Paper DM09-2012 A Basic Recipe for Building a Campaign Management System from Scratch: How Base SAS, SQL Server and Access can Blend Together Tera Olson, Aimia Proprietary Loyalty U.S. Inc., Minneapolis,
More informationDynamic Decision-Making Web Services Using SAS Stored Processes and SAS Business Rules Manager
Paper SAS1787-2015 Dynamic Decision-Making Web Services Using SAS Stored Processes and SAS Business Rules Manager Chris Upton and Lori Small, SAS Institute Inc. ABSTRACT With the latest release of SAS
More informationUsing Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX
Paper 126-29 Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX ABSTRACT This hands-on workshop shows how to use the SAS Macro Facility
More informationImporting Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC
ABSTRACT PharmaSUG 2012 - Paper CC07 Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC In Pharmaceuticals/CRO industries, Excel files are widely use for data storage.
More informationQuick Start to Data Analysis with SAS Table of Contents. Chapter 1 Introduction 1. Chapter 2 SAS Programming Concepts 7
Chapter 1 Introduction 1 SAS: The Complete Research Tool 1 Objectives 2 A Note About Syntax and Examples 2 Syntax 2 Examples 3 Organization 4 Chapter by Chapter 4 What This Book Is Not 5 Chapter 2 SAS
More informationABSTRACT INTRODUCTION CLINICAL PROJECT TRACKER OF SAS TASKS. Paper PH-02-2015
Paper PH-02-2015 Project Management of SAS Tasks - Excel Dashboard without Using Any Program Kalaivani Raghunathan, Quartesian Clinical Research Pvt. Ltd, Bangalore, India ABSTRACT Have you ever imagined
More informationMacros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility
Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility Michael G. Sadof, MGS Associates, Inc., Bethesda, MD. ABSTRACT The macro facility is an important feature of the
More informationModifying Insurance Rating Territories Via Clustering
Modifying Insurance Rating Territories Via Clustering Quncai Zou, New Jersey Manufacturers Insurance Company, West Trenton, NJ Ryan Diehl, New Jersey Manufacturers Insurance Company, West Trenton, NJ ABSTRACT
More informationMicrosoft Access Basics
Microsoft Access Basics 2006 ipic Development Group, LLC Authored by James D Ballotti Microsoft, Access, Excel, Word, and Office are registered trademarks of the Microsoft Corporation Version 1 - Revision
More informationARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT, 15.1200.40
SOFTWARE DEVELOPMENT, 15.1200.40 STANDARD 1.0 APPLY PROBLEM-SOLVING AND CRITICAL THINKING SKILLS TO INFORMATION 1.1 Describe methods of establishing priorities 1.2 Prepare a plan of work and schedule information
More informationChapter 1. Designing Database Tables
Chapter 1 Designing Database Tables 1.1 Introduction 2 1.2 Database Design 2 1.2.1 Conceptual View 2 1.2.2 Table Definitions 3 1.2.3 Redundant Information 4 1.2.4 Normalization 4 1.2.5 Normalization Strategies
More informationIBM. REXX/400 Programmer s Guide. AS/400 Advanced Series. Version 4 SC41-5728-00
AS/400 Advanced Series IBM REXX/400 Programmer s Guide Version 4 SC41-5728-00 AS/400 Advanced Series IBM REXX/400 Programmer s Guide Version 4 SC41-5728-00 Take Note! Before using this information and
More information14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:
14 Databases 14.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define a database and a database management system (DBMS)
More informationOracle Database 11g SQL
AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries
More informationFINDING ORACLE TABLE METADATA WITH PROC CONTENTS
Finding Oracle Table Metadata: When PROC CONTENTS Is Not Enough Jeremy W. Poling, B&W Y-12 L.L.C., Oak Ridge, TN ABSTRACT Complex Oracle databases often contain hundreds of linked tables. For SAS/ACCESS
More informationdbspeak DBs peak when we speak
Data Profiling: A Practitioner s approach using Dataflux [Data profiling] employs analytic methods for looking at data for the purpose of developing a thorough understanding of the content, structure,
More informationLet There Be Highlights: Data-driven Cell, Row and Column Highlights in %TAB2HTM and %DS2HTM Output. Matthew Flynn and Ray Pass
Let There Be Highlights: Data-driven Cell, Row and Column Highlights in %TAB2HTM and %DS2HTM Output Matthew Flynn and Ray Pass Introduction Version 6.12 of the SAS System Technical Support supplied macros
More informationPharmaSUG 2014 Paper CC23. Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA
PharmaSUG 2014 Paper CC23 Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA ABSTRACT Wouldn t it be nice if all of the outputs in a deliverable
More informationInstant SQL Programming
Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions
More informationSame 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 informationQuerying Microsoft SQL Server 2012
Course 10774A: Querying Microsoft SQL Server 2012 Length: 5 Days Language(s): English Audience(s): IT Professionals Level: 200 Technology: Microsoft SQL Server 2012 Type: Course Delivery Method: Instructor-led
More informationSubsetting 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 informationTen Things You Should Know About PROC FORMAT Jack Shoemaker, Accordant Health Services, Greensboro, NC
Ten Things You Should Know About PROC FORMAT Jack Shoemaker, Accordant Health Services, Greensboro, NC ABSTRACT The SAS system shares many features with other programming languages and reporting packages.
More informationDatabase Programming with PL/SQL: Learning Objectives
Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs
More informationFundamentals of Programming and Software Development Lesson Objectives
Lesson Unit 1: INTRODUCTION TO COMPUTERS Computer History Create a timeline illustrating the most significant contributions to computing technology Describe the history and evolution of the computer Identify
More informationFlowchart Techniques
C H A P T E R 1 Flowchart Techniques 1.1 Programming Aids Programmers use different kinds of tools or aids which help them in developing programs faster and better. Such aids are studied in the following
More informationCourse 10774A: Querying Microsoft SQL Server 2012
Course 10774A: Querying Microsoft SQL Server 2012 About this Course This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft
More information