12. Combining SAS datasets. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 269
|
|
- Christal Evans
- 5 years ago
- Views:
Transcription
1 12. Combining SAS datasets 269
2 Appending datasets in different situa)ons PROC PRINT DATA=Lib9_3.emps; PROC PRINT DATA=Lib9_3.emps2008; PROC PRINT DATA=Lib9_3.emps2009; PROC PRINT DATA=Lib9_3.emps2010; 270
3 PROC APPEND PROC APPEND BASE=base-dataset DATA=data-dataset; - BASE = names the dataset to which observa)ons are added - DATA = names the dataset containing observa)ons that are added to the base dataset SAS does not create a new dataset: PROC APPEND adds the observa)ons of a dataset at the end of the base-dataset - Only two datasets can be used at a )me in one step - The observa)ons in the base-dataset are not read - The variable informa)on in the descriptor por)on of the base-dataset cannot change DATA work.emps; SET Lib9_3.emps; PROC APPEND BASE=work.emps DATA=Lib9_3.emps2008; PROC PRINT DATA=work.emps; 271
4 A second example If the base-dataset contains variable(s) not present in the data-dataset, SAS specifies a missing value for this variable(s) PROC APPEND BASE=work.emps DATA=Lib9_3.emps2009; PROC PRINT DATA=work.emps; 272
5 The FORCE op)on PROC APPEND BASE=work.emps DATA=Lib9_3.emps2010; PROC PRINT DATA=work.emps; This program will not do its job.. See the log PROC APPEND BASE=base-dataset DATA=data-dataset FORCE; We need it when the data-dataset contains variables that - Are not in the base-dataset - Are of different type (character/numeric) - Are longer than the variables in the base-dataset 273
6 What SAS does when the FORCE op)on is used PROC APPEND BASE=work.emps DATA=Lib9_3.emps2010 FORCE; PROC PRINT DATA=work.emps; 274
7 Using the DATA step for concatena)ng datasets DATA output-dataset ; SET dataset1 dataset2 ; <addi+onal SAS statements> ; - output-dataset names the dataset to be created - dataset1 dataset2 are the datasets to be read This program creates a new dataset in which observa)ons of successive datasets are added at the end of the previous datasest, as listed in the SET statement How the DATA step works with two datasets: - SAS reads variables from the first dataset and a PDV is created - SAS reads variables from the second dataset and eventually the PDV is completed - SAS reads each observa)on in the first dataset, writes it in the PDV and from there in the output dataset - SAS reads each observa)on in the second dataset, writes it in the PDV and from there in the output dataset The new dataset contains all of the variables and observa)ons from all of the input datasets 275
8 Concatena)ng datasets with different variables empsdk empsfr empscn empsjp PROC PRINT DATA=Lib9_3.empsdk; PROC PRINT DATA=Lib9_3.empsfr; PROC PRINT DATA=Lib9_3.empscn; PROC PRINT DATA=Lib9_3.empsjp; Same name DATA empsall1; SET Lib9_3.empsdk Lib9_3.empsfr; PROC PRINT DATA=empsall1; Different name DATA empsall2; SET Lib9_3.empscn Lib9_3.empsjp; PROC PRINT DATA=empsall2; 276
9 RENAME= op)on You can rename a variable using the RENAME op)on in a DATA step (RENAME= (old-name1 = new-name1 old-name2 = new-name2 old-namen = new-namen)) - old-name : the variable to be renamed - new-name : the new name for the variable - You can use rename in different statements of a data step (e.g. MERGE) DATA empsall2; SET Lib9_3.empscn Lib9_3.empsjp ( RENAME= (Region = Country) ); PROC PRINT DATA=empsall2; N.B.: RENAMES= op)on does not rename the variable in the input dataset, but it tells SAS which slot in the PDV to use when building the observa)ons 277
10 How concatena)on works if there are common variables If variables from different input datasets share the same name and: - Different type a{ribute: SAS stops proceedings the DATA step and gives an error message - Different length, label, format or informat a{ributes: SAS takes the a{ributes of the variable in the first dataset PROC CONTENTS DATA=Lib9_3.empscn; DATA empscn; LENGTH Country $ 5; SET Lib9_3.empscn; PROC PRINT DATA=empscn; DATA empsall3; SET empscn Lib9_3.empsdk; PROC PRINT DATA=empsall3; 278
11 Appending vs Concatena)ng (1) 279
12 Appending vs Concatena)ng (2) 280
13 Interleaving datasets 281
14 DATA step for interleaving DATA dataset; SET SET-dataset1 SET-dataset2.. ; BY <DESCENDING> BY-variable(s); <addi+onal statements>; - dataset : names the data to be created - SET-dataset : the datasets to be read - BY-variable(s): variables used to inteleave observa)on N.B.: Each input dataset must be sorted by the BY-variable DATA empsall4; SET Lib9_3.empscn Lib9_3.empsjp (RENAME=(Region=Country)); BY First; PROC PRINT DATA=empsall4; - SAS sorts duplicate BY-values in different datasets in the order in which their datasets are listed in the SET statement - SAS sorts duplicate BY-values in a dataset in the order in which they appear in the dataset 282
15 One-to-one reading DATA output-dataset; SET input-dataset1 ; SET input-dataset2 ; - output-dataset names the dataset to be created - input-dataset1 and input-dataset2 specify the dataset to be read - The new dataset contains all the variables from all the input datasets. - If the datasets contain variables that have the same name, the values which were read from the last dataset overwrite the values which were read from earlier datasets - The first observa)on in one dataset is joined with the first observa)on in the other, and so on. - The DATA step stops a er reading the last observa)on from the smallest dataset. Hence, the number of observa)on in the new dataset is the number of observa)on of the smallest dataset DATA emps_oto; SET Lib9_3.empsau ; SET Lib9_3.PhoneH ; PROC PRINT DATA=emps_OTO; 283
16 One-to-one reading DATA output-dataset; SET input-dataset1 ; SET input-dataset2 ; - output-dataset names the dataset to be created - input-dataset1 and input-dataset2 specify the dataset to be read - The new dataset contains all the variables from all the input datasets. - If the datasets contain variables that have the same name, the values which were read from the last dataset overwrite the values which were read from earlier datasets - The first observa)on in one dataset is joined with the first observa)on in the other, and so on. - The DATA step stops a er reading the last observa)on from the smallest dataset. Hence, the number of observa)on in the new dataset is the number of observa)on of the smallest dataset. DATA emps_oto; SET Lib9_3.emps ; SET Lib9_3.emps2010 ; PROC PRINT DATA=emps_OTO; 284
17 Match-merging Match-merging means to combine observa)ons from two or more datasets into a single observa)on in a new dataset according to the values of a common variable DATA output-dataset; MERGE input-dataset1 input-dataset2 ; BY <DESCENDING> BY-variable(s) ; REMEMBER TO SORT THE INPUT DATASET! If you don t do it, SAS gives you an error - output-dataset names the dataset to be created - input-dataset1 and input-dataset2 specify the dataset to be read. If you specify only a dataset, MERGE statement behaviors as SET statement - BY-variable, whose values are used to match observa)ons. They must have the same type in all datasets to be merged - <DESCENDING> op)on must be applied if by-variable is sorted in descending order in the input datasets - Basic match-merging produces an output dataset that contains values from all observabons in all input dataset - If an input dataset doesn t have any observa)ons for a par)cular value of the byvariable, then the observa)on in the output dataset contains missing values for the variables that are unique to that input dataset - Match merging can be done also using a PROC SQL step 285
18 One-to-one match merging: Ex. #1 DATA emps_oto; SET Lib9_3.empsau ; SET Lib9_3.PhoneH ; PROC PRINT DATA=emps_OTO; DATA emps_oto; MERGE Lib9_3.empsau Lib9_3.PhoneH ; BY EmpID ; PROC PRINT DATA=emps_OTO; 286
19 One-to-One match merging: Ex. #2 PROC SORT DATA= Lib9_3.emps OUT=sortemps; BY First; PROC SORT DATA= Lib9_3.emps2010 OUT=sortemps2010; BY First; DATA emps_oto; MERGE sortemps sortemps2010 ; BY First ; PROC PRINT DATA=emps_OTO; DATA emps_oto; SET sortemps; SET sortemps2010; PROC PRINT DATA=emps_OTO; 287
20 One to Many match-merging DATA emps_otm; MERGE Lib9_3.empsau Lib9_3.PhoneHW ; BY EmpID ; PROC PRINT DATA=emps_OTM; 288
21 How SAS processes the step: In the compila)on phase, SAS: compila)on phase - Creates the PDV reading the datasets in the order they are listed in the MERGE statement - Assigns a tracking pointer to each dataset 289
22 How SAS processes the step: execu)on phase (1) SAS reads the first observa)ons of each dataset: they are in the same by-group OUTPUT DATASET The values remain in the PDV (as the input datasets are SAS datasets) and SAS starts the second itera)on 290
23 How SAS processes the step: execu)on phase (2) SAS reads the second observa)ons of each dataset: since the obs in the second dataset is in the same by-group as the obs the PDV, SAS overwrites the values of Type and Phone in the PDV PDV OUTPUT DATASET The values remain in the PDV and SAS starts the third itera)on 291
24 How SAS processes the step: execu)on phase (3) PDV SAS reads the second observa)on from the first dataset and the third observa)on from the second dataset Since they are not in the same by-group as the obs in the PDV, SAS reini)alizes the PDV to missing data SAS reads the current observa)ons from the two dataset in PDV: PDV The values remain in the PDV and SAS starts the fourth itera)on To the output dataset 292
25 How SAS processes the step: execu)on phase (4) SAS con)nues processing in this way un)ll the end of both the datasets 293
26 No matches case What does it happen when there are groups (levels) of the BY-variable which are not shared by the INPUT datasets? DATA emps_nm; MERGE Lib9_3.empsau Lib9_3.PhoneC ; BY EmpID ; PROC PRINT DATA=emps_NM; 294
27 No match case: How SAS processes In the compilabon phase, SAS: the compila)on phase - Creates the PDV reading the datasets in the order they are listed in the MERGE statement - Assignes a tracking pointer to each dataset 295
28 No match case: How SAS processes the execu)on phase (1) SAS reads the first observa)ons of each dataset: they are in the same by-group OUTPUT DATASET The values remain in the PDV and SAS starts the second itera)on 296
29 How SAS processes the execu)on phase (2) SAS reads the second observa)ons of each dataset: since they are not in the same by-group as the obs in the PDV, SAS reini)alizes the PDV to missing data SAS chooses the observa)on in the first dataset ( < ), and writes it in PDV.... And in the OUTPUT Dataset The values remain in the PDV and SAS starts the third itera)on 297
30 How SAS processes the execu)on phase (3) SAS reads the third obs of the first dataset and the second obs of the second dataset: since they are not in the same by-group as the obs in the PDV, SAS reini)alizes the PDV to MD SAS reads the current observa)ons from the two dataset in PDV and then in the OUTPUT DATASET The values remain in the PDV and SAS starts the fourth itera)on 298
31 How SAS processes the execu)on phase (4) SAS con)nues processing in this way un)ll the end of both the datasets - Matching observa)ons which contain data from both the datasets - Non-matching observa)ons which contain data from one of the datasets 299
32 Selec)ng only matches (or not-matches) (IN=variable) variable : the name you give to a temporary variable into the PDV which equals 1 if the observa)on from the MERGE dataset contributes to the current observa)on of the output dataset and 0 otherwise Using IN= op)on in the MERGE statement with an IF statement allows selecbng only matches and non-matches DATA emps_onlym; MERGE Lib9_3.empsau (IN=emps) Lib9_3.PhoneC (IN=cell); BY EmpID ; IF (emps AND cell); PROC PRINT DATA=emps_onlyM; DATA emps_onlynm; MERGE Lib9_3.empsau (IN=emps) Lib9_3.PhoneC (IN=cell); BY EmpID ; IF (emps=0 OR cell=0); PROC PRINT DATA=emps_onlyNM; 300
33 Many to Many match-merging DATA emps_mtm; MERGE Lib9_3.empsAUUS Lib9_3.PhoneO; BY Country ; PROC PRINT DATA=emps_MTM; N.B.: - This procedure provides an dataset with six lines - If we want a 12-obs dataset (any combina)on of obs which share the same level) we must use the SQL PROC 301
34 Using data manipula)on techniques with a data merge 302
35 Who purchased what? PROC PRINT DATA=Lib9_3.Customer (OBS=20); PROC PRINT DATA=Lib9_3.Order_fact (OBS=20); PROC CONTENTS DATA=Lib9_3.Customer; PROC CONTENTS DATA=Lib9_3.Order_fact; PROC SORT DATA=Lib9_3.Order_fact OUT=Order_fact; BY Customer_ID; DATA CustOrd; MERGE Lib9_3.Customer Work.Order_fact ; BY Customer_ID ; PROC PRINT DATA=CustOrd (OBS=30); In the dataset CustOrd the same Customer ID is repeated for each order 303
36 Outpuzng two datasets We want to divide the merged dataset in two datasets: Orders (in which we retain only variables Customer_Name, Quan)ty and Total_Retail_Price) and NoOrders (in which we retain only variables Customer_Name and Birth_date). - In the first dataset we put the observa)ons which contain informa)on about the orders - In the second dataset we put observa)ons about customers which made no orders. DATA Orders (KEEP=Customer_Name Quan)ty Total_Retail_Price) NoOrders (KEEP=Customer_Name Birth_Date) ; MERGE Lib9_3.Customer Work.Order_fact (IN=order); BY Customer_ID ; IF order=1 THEN OUTPUT Orders; ELSE OUTPUT NoOrders; PROC PRINT DATA=Orders; PROC PRINT DATA=NoOrders; 304
37 Summing up the # of orders for each customer We want to create also a third dadaset, called Summary, in which there are two variables: Customer_Name and a new variable named NumberOrders, which counts the number of orders for each customer DATA Orders (KEEP=Customer_Name Quan)ty Total_Retail_Price) NoOrders (KEEP=Customer_Name Birth_Date) Summary (KEEP=Customer_Name NumberOrders) ; MERGE Lib9_3.Customer Work.Order_fact (IN=order); BY Customer_ID ; IF order=1 THEN DO; OUTPUT Orders; IF First.Customer_ID THEN NumberOrders=0; NumberOrders+1; IF Last.Customer_ID THEN OUTPUT Summary; END; ELSE OUTPUT NoOrders; PROC PRINT DATA=Summary; 305
11. Reading SAS datasets. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 242
11. Reading SAS datasets 242 Reading a single SAS dataset DATA SAS-dataset; SET SAS-dataset; ; - SAS-dataset in the DATA statement is the name (libref.filename) of the dataset to be
More informationChapter 6: Modifying and Combining Data Sets
Chapter 6: Modifying and Combining Data Sets The SET statement is a powerful statement in the DATA step. Its main use is to read in a previously created SAS data set which can be modified and saved as
More information15. Processing variables with arrays. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 343
15. Processing variables with arrays 343 SAS Arrays A SAS array is a temporary grouping of SAS variables under a single name. It exists only for the dura)on of the DATA step Useful for processing several
More informationBase and Advance SAS
Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS
More informationMerge Processing and Alternate Table Lookup Techniques Prepared by
Merge Processing and Alternate Table Lookup Techniques Prepared by The syntax for data step merging is as follows: International SAS Training and Consulting This assumes that the incoming data sets are
More informationINTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS
TO SAS NEED FOR SAS WHO USES SAS WHAT IS SAS? OVERVIEW OF BASE SAS SOFTWARE DATA MANAGEMENT FACILITY STRUCTURE OF SAS DATASET SAS PROGRAM PROGRAMMING LANGUAGE ELEMENTS OF THE SAS LANGUAGE RULES FOR SAS
More informationThe inner workings of the datastep. By Mathieu Gaouette Videotron
The inner workings of the datastep By Mathieu Gaouette Videotron Plan Introduction The base The base behind the scene Control in the datastep A side by side compare with Proc SQL Introduction Most of you
More informationProgramming Beyond the Basics. Find() the power of Hash - How, Why and When to use the SAS Hash Object John Blackwell
Find() the power of Hash - How, Why and When to use the SAS Hash Object John Blackwell ABSTRACT The SAS hash object has come of age in SAS 9.2, giving the SAS programmer the ability to quickly do things
More informationGeneral Tips for Working with Large SAS datasets and Oracle tables
General Tips for Working with Large SAS datasets and Oracle tables 1) Avoid duplicating Oracle tables as SAS datasets only keep the rows and columns needed for your analysis. Use keep/drop/where directly
More information9 Ways to Join Two Datasets David Franklin, Independent Consultant, New Hampshire, USA
9 Ways to Join Two Datasets David Franklin, Independent Consultant, New Hampshire, USA ABSTRACT Joining or merging data is one of the fundamental actions carried out when manipulating data to bring it
More informationSAS - By Group Processing umanitoba.ca/centres/mchp
SAS - By Group Processing umanitoba.ca/centres/mchp Winnipeg SAS users Group SAS By Group Processing Are you First or Last In Line Charles Burchill Manitoba Centre for Health Policy, University of Manitoba
More information3. Data Tables & Data Management
3. Data Tables & Data Management In this lab, we will learn how to create and manage data tables for analysis. We work with a very simple example, so it is easy to see what the code does. In your own projects
More informationSAS CURRICULUM. BASE SAS Introduction
SAS CURRICULUM BASE SAS Introduction Data Warehousing Concepts What is a Data Warehouse? What is a Data Mart? What is the difference between Relational Databases and the Data in Data Warehouse (OLTP versus
More informationChecking for Duplicates Wendi L. Wright
Checking for Duplicates Wendi L. Wright ABSTRACT This introductory level paper demonstrates a quick way to find duplicates in a dataset (with both simple and complex keys). It discusses what to do when
More informationGary L. Katsanis, Blue Cross and Blue Shield of the Rochester Area, Rochester, NY
Table Lookups in the SAS Data Step Gary L. Katsanis, Blue Cross and Blue Shield of the Rochester Area, Rochester, NY Introduction - What is a Table Lookup? You have a sales file with one observation for
More information16. Reading raw data in fixed fields. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 364
16. Reading raw data in fixed fields 364 Reading raw Dataset: three solu)ons You can mix all of them! Data that SAS cannot read without further informa)on 365 Reading standard data with column input: review
More informationIf You Need These OBS and These VARS, Then Drop IF, and Keep WHERE Jay Iyengar, Data Systems Consultants LLC
Paper 2417-2018 If You Need These OBS and These VARS, Then Drop IF, and Keep WHERE Jay Iyengar, Data Systems Consultants LLC ABSTRACT Reading data effectively in the DATA step requires knowing the implications
More informationNot Just Merge - Complex Derivation Made Easy by Hash Object
ABSTRACT PharmaSUG 2015 - Paper BB18 Not Just Merge - Complex Derivation Made Easy by Hash Object Lu Zhang, PPD, Beijing, China Hash object is known as a data look-up technique widely used in data steps
More informationSAS Online Training: Course contents: Agenda:
SAS Online Training: Course contents: Agenda: (1) Base SAS (6) Clinical SAS Online Training with Real time Projects (2) Advance SAS (7) Financial SAS Training Real time Projects (3) SQL (8) CV preparation
More informationSAS Enterprise Guide and Add-In for Microsoft Office Hands-on Workshop
SAS Enterprise Guide and Add-In for Microsoft Office Hands-on Workshop SAS Australia and New Zealand V2.1 1-2 Chapter 1 SAS Enterprise Guide and Add-In for Microsoft Office Hands-on Workshop Chapter 1
More informationContents Contents Introduction Basic Steps in Query Processing Introduction Transformation of Relational Expressions...
Contents Contents...283 Introduction...283 Basic Steps in Query Processing...284 Introduction...285 Transformation of Relational Expressions...287 Equivalence Rules...289 Transformation Example: Pushing
More informationHow to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U?
Paper 54-25 How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Andrew T. Kuligowski Nielsen Media Research Abstract / Introduction S-M-U. Some people will see these three letters and
More information2. Referencing Files and Sepng Op+ons. GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 47
2. Referencing Files and Sepng Op+ons GIORGIO RUSSOLILLO - Cours de prépara+on à la cer+fica+on SAS «Base Programming» 47 Defining SAS libraries To reference a permanent SAS file you: - Assign a name (libref)
More informationThe Proc Transpose Cookbook
ABSTRACT PharmaSUG 2017 - Paper TT13 The Proc Transpose Cookbook Douglas Zirbel, Wells Fargo and Co. Proc TRANSPOSE rearranges columns and rows of SAS datasets, but its documentation and behavior can be
More informationMerging Data Eight Different Ways
Paper 197-2009 Merging Data Eight Different Ways David Franklin, Independent Consultant, New Hampshire, USA ABSTRACT Merging data is a fundamental function carried out when manipulating data to bring it
More informationA Simple Framework for Sequentially Processing Hierarchical Data Sets for Large Surveys
A Simple Framework for Sequentially Processing Hierarchical Data Sets for Large Surveys Richard L. Downs, Jr. and Pura A. Peréz U.S. Bureau of the Census, Washington, D.C. ABSTRACT This paper explains
More informationThe Building Blocks of SAS Datasets. (Set, Merge, and Update) Andrew T. Kuligowski FCCI Insurance Group
The Building Blocks of SAS Datasets S-M-U (Set, Merge, and Update) Andrew T. Kuligowski FCCI Insurance Group S-M-U What is S M U? 2 S-M-U What is S M U? Shmoo? 3 S-M-U What is S M U? Southern Methodist
More informationT.I.P.S. (Techniques and Information for Programming in SAS )
Paper PO-088 T.I.P.S. (Techniques and Information for Programming in SAS ) Kathy Harkins, Carolyn Maass, Mary Anne Rutkowski Merck Research Laboratories, Upper Gwynedd, PA ABSTRACT: This paper provides
More informationLABORATORY OF DATA SCIENCE. ETL Extract, Transform and Load. Data Science & Business Informatics Degree
LABORATORY OF DATA SCIENCE ETL Extract, Transform and Load Data Science & Business Informatics Degree BI Architecture 2 6 lessons data access 4 lessons data quality & ETL 1 lessons analytic SQL 6 lessons
More informationPlease don't Merge without By!!
ABSTRACT Please don't Merge without By!! Monal Kohli Have you ever merged datasets and forgotten a by Statement, looked at the results and thought wow -- 100% match but when you started validating the
More informationEssentials of PDV: Directing the Aim to Understanding the DATA Step! Arthur Xuejun Li, City of Hope National Medical Center, Duarte, CA
PharmaSUG 2013 - Paper TF17 Essentials of PDV: Directing the Aim to Understanding the DATA Step! Arthur Xuejun Li, City of Hope National Medical Center, Duarte, CA ABSTRACT Beginning programmers often
More informationBASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS
SAS COURSE CONTENT Course Duration - 40hrs BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS What is SAS History of SAS Modules available SAS GETTING STARTED
More informationAutomating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA
Automating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA ABSTRACT: Have you ever been asked to compare new datasets to old datasets while transfers of data occur several
More informationTutorial for our Client Portal
Tutorial for our Client Portal Use of the Portal requires a Login assigned by WuXi AppTec. If you do not have a Login, contact your WuXi AppTec Account Manager. If you need technical assistance with using
More informationMicrosoft Access Illustrated. Unit B: Building and Using Queries
Microsoft Access 2010- Illustrated Unit B: Building and Using Queries Objectives Use the Query Wizard Work with data in a query Use Query Design View Sort and find data (continued) Microsoft Office 2010-Illustrated
More information3. Almost always use system options options compress =yes nocenter; /* mostly use */ options ps=9999 ls=200;
Randy s SAS hints, updated Feb 6, 2014 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, first version: March 8, 2013 ***************; 2. Don
More informationInterleaving a Dataset with Itself: How and Why
cc002 Interleaving a Dataset with Itself: How and Why Howard Schreier, U.S. Dept. of Commerce, Washington DC ABSTRACT When two or more SAS datasets are combined by means of a SET statement and an accompanying
More informationUpdating Data Using the MODIFY Statement and the KEY= Option
Updating Data Using the MODIFY Statement and the KEY= Option Denise J. Moorman and Deanna Warner Denise J. Moorman is a technical support analyst at SAS Institute. Her area of expertise is base SAS software.
More informationHow to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U?
How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Andrew T. Kuligowski Nielsen Media Research Abstract / Introduction S-M-U. Some people will see these three letters and immediately
More informationChoosing the Right Technique to Merge Large Data Sets Efficiently Qingfeng Liang, Community Care Behavioral Health Organization, Pittsburgh, PA
Choosing the Right Technique to Merge Large Data Sets Efficiently Qingfeng Liang, Community Care Behavioral Health Organization, Pittsburgh, PA ABSTRACT This paper outlines different SAS merging techniques
More informationPaper Haven't I Seen You Before? An Application of DATA Step HASH for Efficient Complex Event Associations. John Schmitz, Luminare Data LLC
Paper 1331-2017 Haven't I Seen You Before? An Application of DATA Step HASH for Efficient Complex Event Associations ABSTRACT John Schmitz, Luminare Data LLC Data processing can sometimes require complex
More informationTor Bengtsson - Statistics Sweden
Techniques for combining SAS data sets Tor Bengtsson - Statistics Sweden There are a lot of different methods to combine SAS data sets on. In this paper some different techniques will be presented and
More informationObjec&ves. Review. Directed Graphs: Strong Connec&vity Greedy Algorithms
Objec&ves Directed Graphs: Strong Connec&vity Greedy Algorithms Ø Interval Scheduling Feb 7, 2018 CSCI211 - Sprenkle 1 Review Compare and contrast directed and undirected graphs What is a topological ordering?
More informationPaper TT17 An Animated Guide : Speed Merges with Key Merging and the _IORC_ Variable Russ Lavery Contractor for Numeric resources, Inc.
Paper TT7 An Animated Guide : Speed Merges with Key Merging and the _IORC_ Variable Russ Lavery Contractor for Numeric resources, Inc. ABSTRACT The key mege (A.K.A. _IORC_ merge) is an efficiency technique.
More informationSTATION
------------------------------STATION 1------------------------------ 1. Which of the following statements displays all user-defined macro variables in the SAS log? a) %put user=; b) %put user; c) %put
More informationContents. About This Book...1
Contents About This Book...1 Chapter 1: Basic Concepts...5 Overview...6 SAS Programs...7 SAS Libraries...13 Referencing SAS Files...15 SAS Data Sets...18 Variable Attributes...21 Summary...26 Practice...28
More informationSAS File Management. Improving Performance CHAPTER 37
519 CHAPTER 37 SAS File Management Improving Performance 519 Moving SAS Files Between Operating Environments 520 Converting SAS Files 520 Repairing Damaged Files 520 Recovering SAS Data Files 521 Recovering
More informationContents of SAS Programming Techniques
Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal
More informationUnit 3 Fill Series, Functions, Sorting
Unit 3 Fill Series, Functions, Sorting Fill enter repetitive values or formulas in an indicated direction Using the Fill command is much faster than using copy and paste you can do entire operation in
More informationUnit 3 Functions Review, Fill Series, Sorting, Merge & Center
Unit 3 Functions Review, Fill Series, Sorting, Merge & Center Function built-in formula that performs simple or complex calculations automatically names a function instead of using operators (+, -, *,
More informationTOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE
TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE Handy Tips for the Savvy Programmer SAS PROGRAMMING BEST PRACTICES Create Readable Code Basic Coding Recommendations» Efficiently choosing data for processing»
More informationSAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables
SAS seminar April 15, 2003 Åsa Klint The little SAS book Chapters 3 & 4 By LD Delwiche and SJ Slaughter Data step - read and modify data - create a new dataset - performs actions on rows Proc step - use
More informationHash Objects for Everyone
SESUG 2015 Paper BB-83 Hash Objects for Everyone Jack Hall, OptumInsight ABSTRACT The introduction of Hash Objects into the SAS toolbag gives programmers a powerful way to improve performance, especially
More informationUncommon Techniques for Common Variables
Paper 11863-2016 Uncommon Techniques for Common Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT If a variable occurs in more than one data set being merged, the last value (from the variable
More informationContents. Overview How SAS processes programs Compilation phase Execution phase Debugging a DATA step Testing your programs
SAS Data Step Contents Overview How SAS processes programs Compilation phase Execution phase Debugging a DATA step Testing your programs 2 Overview Introduction This section teaches you what happens "behind
More informationLecture 15 : Review DRAFT
CS/Math 240: Introduction to Discrete Mathematics 3/10/2011 Lecture 15 : Review Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Today slectureservesasareviewofthematerialthatwillappearonyoursecondmidtermexam.
More informationThrough Python. "Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura..." Dante Alighieri
Through Python "Nel mezzo del cammin di nostra vita mi ritrovai per una selva oscura..." Dante Alighieri Syllabus Variables vs object Float representa2on The importance of syntax operator overloading built-in
More informationCreating and Executing Stored Compiled DATA Step Programs
465 CHAPTER 30 Creating and Executing Stored Compiled DATA Step Programs Definition 465 Uses for Stored Compiled DATA Step Programs 465 Restrictions and Requirements 466 How SAS Processes Stored Compiled
More informationACCESS Procedure Reference
59 CHAPTER 5 ACCESS Procedure Reference Introduction 59 Case Sensitivity in the ACCESS Procedure 60 ACCESS Procedure 60 Description 61 PROC ACCESS Statement Options 62 Options 62 SAS System Passwords for
More informationCleaning up your SAS log: Note Messages
Paper 9541-2016 Cleaning up your SAS log: Note Messages ABSTRACT Jennifer Srivastava, Quintiles Transnational Corporation, Durham, NC As a SAS programmer, you probably spend some of your time reading and
More informationInstalling SQL 2005 Express Edition
Installing SQL 2005 Express Edition Go to www.msdn.microsoft.com/vstudio/express/sql The following page will appear Click on the button Select the option I don t want to register Please take me to the
More informationPower Query for Parsing Data
Excel Power Query Power Query for Parsing Data Data Models Screen 1In Excel 2010 and 2013 need to install the Power Query; however, in 2016 is automatically part of the Data Tab ribbon and the commands
More informationTechdata Solution. SAS Analytics (Clinical/Finance/Banking)
+91-9702066624 Techdata Solution Training - Staffing - Consulting Mumbai & Pune SAS Analytics (Clinical/Finance/Banking) What is SAS SAS (pronounced "sass", originally Statistical Analysis System) is an
More informationSimple sets of data can be expressed in a simple table, much like a
Chapter 1: Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages
More informationTips and Tricks for SAS Programmers. SUCCESS March 2018 Mary Harding
Tips and Tricks for SAS Programmers SUCCESS March 2018 Mary Harding Copyright SAS Institute Inc. All rights reserved. Agenda Tip 1 Sorting tip Tip 2 Don t read data over and over again :SASFILE Tip 3 Pattern
More information2. Don t forget semicolons and RUN statements The two most common programming errors.
Randy s SAS hints March 7, 2013 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, March 8, 2013 ***************; 2. Don t forget semicolons and
More informationNew Vs. Old Under the Hood with Procs CONTENTS and COMPARE Patricia Hettinger, SAS Professional, Oakbrook Terrace, IL
Paper SS-03 New Vs. Old Under the Hood with Procs CONTENTS and COMPARE Patricia Hettinger, SAS Professional, Oakbrook Terrace, IL ABSTRACT There s SuperCE for comparing text files on the mainframe. Diff
More informationWorking with Big Data in SAS
ABSTRACT Paper SAS2160-2018 Working with Big Data in SAS Mark L. Jordan, SAS Institute Inc. This paper demonstrates challenges and solutions when using SAS to process large data sets. Learn how to do the
More informationDavid Franklin Independent SAS Consultant TheProgramersCabin.com
Countdown of the Top 10 Ways to Merge Data Trivia The film The Poseidon Adventure is based on a real life event that involved the Queen Mary in 1942 the ship was hit by a 92 foot wave which listed the
More informationADD AND NAME WORKSHEETS
1 INTERMEDIATE EXCEL While its primary function is to be a number cruncher, Excel is a versatile program that is used in a variety of ways. Because it easily organizes, manages, and displays information,
More informationEffectively Utilizing Loops and Arrays in the DATA Step
Paper 1618-2014 Effectively Utilizing Loops and Arrays in the DATA Step Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT The implicit loop refers to the DATA step repetitively reading
More informationSUGI 29 Data Warehousing, Management and Quality
Building a Purchasing Data Warehouse for SRM from Disparate Procurement Systems Zeph Stemle, Qualex Consulting Services, Inc., Union, KY ABSTRACT SAS Supplier Relationship Management (SRM) solution offers
More informationHow MERGE Really Works
How MERGE Really Works Bob Virgile Robert Virgile Associates, Inc. Overview Do your MERGEs produce unexpected results? Three basic DATA step concepts resolve the complexities of MERGE: compile and execute,
More informationFrom Manual to Automatic with Overdrive - Using SAS to Automate Report Generation Faron Kincheloe, Baylor University, Waco, TX
Paper 152-27 From Manual to Automatic with Overdrive - Using SAS to Automate Report Generation Faron Kincheloe, Baylor University, Waco, TX ABSTRACT This paper is a case study of how SAS products were
More informationIntroduction / Overview
Paper # SC18 Exploring SAS Generation Data Sets Kirk Paul Lafler, Software Intelligence Corporation Abstract Users have at their disposal a unique and powerful feature for retaining historical copies of
More informationPerformance Op>miza>on
ECPE 170 Jeff Shafer University of the Pacific Performance Op>miza>on 2 Lab Schedule This Week Ac>vi>es Background discussion Lab 5 Performance Measurement Lab 6 Performance Op;miza;on Lab 5 Assignments
More informationCS 465 Final Review. Fall 2017 Prof. Daniel Menasce
CS 465 Final Review Fall 2017 Prof. Daniel Menasce Ques@ons What are the types of hazards in a datapath and how each of them can be mi@gated? State and explain some of the methods used to deal with branch
More informationTop 10 Ways to Optimize Your SAS Code Jeff Simpson SAS Customer Loyalty
Top 10 Ways to Optimize Your SAS Code Jeff Simpson SAS Customer Loyalty Writing efficient SAS programs means balancing the constraints of TIME Writing efficient SAS programs means balancing Time and SPACE
More informationOLAP Drill-through Table Considerations
Paper 023-2014 OLAP Drill-through Table Considerations M. Michelle Buchecker, SAS Institute, Inc. ABSTRACT When creating an OLAP cube, you have the option of specifying a drill-through table, also known
More informationDSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017
DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017 There are a handful of statements (TITLE, FOOTNOTE, WHERE, BY, etc.) that can be used in a wide variety of procedures. For example,
More informationCompiler Optimization Intermediate Representation
Compiler Optimization Intermediate Representation Virendra Singh Associate Professor Computer Architecture and Dependable Systems Lab Department of Electrical Engineering Indian Institute of Technology
More informationSESUG 2014 IT-82 SAS-Enterprise Guide for Institutional Research and Other Data Scientists Claudia W. McCann, East Carolina University.
Abstract Data requests can range from on-the-fly, need it yesterday, to extended projects taking several weeks or months to complete. Often institutional researchers and other data scientists are juggling
More informationAndrew H. Karp Sierra Information Services, Inc. San Francisco, California USA
Indexing and Compressing SAS Data Sets: How, Why, and Why Not Andrew H. Karp Sierra Information Services, Inc. San Francisco, California USA Many users of SAS System software, especially those working
More informationAre you Still Afraid of Using Arrays? Let s Explore their Advantages
Paper CT07 Are you Still Afraid of Using Arrays? Let s Explore their Advantages Vladyslav Khudov, Experis Clinical, Kharkiv, Ukraine ABSTRACT At first glance, arrays in SAS seem to be a complicated and
More informationIntroduction to SAS Mike Zdeb ( , #1
Mike Zdeb (402-6479, msz03@albany.edu) #1 (10) REARRANGING DATA If you want to conduct an analysis across observations in a data set, you can use SAS procedures. If you want to conduct an analysis within
More informationHash Objects Why Bother? Barb Crowther SAS Technical Training Specialist. Copyright 2008, SAS Institute Inc. All rights reserved.
Hash Objects Why Bother? Barb Crowther SAS Technical Training Specialist Purpose The purpose of this presentation is not to teach you how to program Hash Objects That s a two hour topic in PRG3. The purpose
More informationSign Up For An Inspire Northeast Wisconsin Account
I m interested! Now What? Sign Up For An Inspire Northeast Signing up for Inspire Northeast Wisconsin is easy just follow these step-by-step direc
More informationCMSC424: Database Design. Instructor: Amol Deshpande
CMSC424: Database Design Instructor: Amol Deshpande amol@cs.umd.edu Databases Data Models Conceptual representa1on of the data Data Retrieval How to ask ques1ons of the database How to answer those ques1ons
More informationChapter 7. Joining Maps to Other Datasets in QGIS
Chapter 7 Joining Maps to Other Datasets in QGIS Skills you will learn: How to join a map layer to a non-map layer in preparation for analysis, based on a common joining field shared by the two tables.
More informationUsing the SQL Editor. Overview CHAPTER 11
205 CHAPTER 11 Using the SQL Editor Overview 205 Opening the SQL Editor Window 206 Entering SQL Statements Directly 206 Entering an SQL Query 206 Entering Non-SELECT SQL Code 207 Creating Template SQL
More informationLeave Your Bad Code Behind: 50 Ways to Make Your SAS Code Execute More Efficiently.
Leave Your Bad Code Behind: 50 Ways to Make Your SAS Code Execute More Efficiently. William E Benjamin Jr Owl Computer Consultancy, LLC 2012 Topic Groups Processing more than one file in each DATA step
More informationWhat were his cri+cisms? Classical Methodologies:
1 2 Classifica+on In this scheme there are several methodologies, such as Process- oriented, Blended, Object Oriented, Rapid development, People oriented and Organisa+onal oriented. According to David
More informationTrust Eleva,on Architecture v03
Trust Eleva,on Architecture v03 DISCUSSION DRAFT 2015-01- 27 Andrew Hughes 1 Purpose of this presenta,on To alempt to explain the Trust Eleva,on mechanism as a form of ALribute Based Access Control To
More informationCountdown of the Top 10 Ways to Merge Data David Franklin, Independent Consultant, Litchfield, NH
PharmaSUG2010 - Paper TU06 Countdown of the Top 10 Ways to Merge Data David Franklin, Independent Consultant, Litchfield, NH ABSTRACT Joining or merging data is one of the fundamental actions carried out
More informationClean & Speed Up Windows with AWO
Clean & Speed Up Windows with AWO C 400 / 1 Manage Windows with this Powerful Collection of System Tools Every version of Windows comes with at least a few programs for managing different aspects of your
More informationIntroduction. Understanding SAS/ACCESS Descriptor Files. CHAPTER 3 Defining SAS/ACCESS Descriptor Files
15 CHAPTER 3 Defining SAS/ACCESS Descriptor Files Introduction 15 Understanding SAS/ACCESS Descriptor Files 15 Creating SAS/ACCESS Descriptor Files 16 The ACCESS Procedure 16 Creating Access Descriptors
More informationPlease Don't Lag Behind LAG!
Please Don't Lag Behind LAG! Anjan Matlapudi and J. Daniel Knapp Pharmacy Informatics and Finance PerformRx, The Next Generation PBM 200 Stevens Drive, Philadelphia, PA 19113 ABSTRACT A programmer may
More informationPaper CT-16 Manage Hierarchical or Associated Data with the RETAIN Statement Alan R. Mann, Independent Consultant, Harpers Ferry, WV
Paper CT-16 Manage Hierarchical or Associated Data with the RETAIN Statement Alan R. Mann, Independent Consultant, Harpers Ferry, WV ABSTRACT For most of the history of computing machinery, hierarchical
More informationAdvanced Databases. Lecture 4 - Query Optimization. Masood Niazi Torshiz Islamic Azad university- Mashhad Branch
Advanced Databases Lecture 4 - Query Optimization Masood Niazi Torshiz Islamic Azad university- Mashhad Branch www.mniazi.ir Query Optimization Introduction Transformation of Relational Expressions Catalog
More informationTaming a Spreadsheet Importation Monster
SESUG 2013 Paper BtB-10 Taming a Spreadsheet Importation Monster Nat Wooding, J. Sargeant Reynolds Community College ABSTRACT As many programmers have learned to their chagrin, it can be easy to read Excel
More information