SAS Macro. SAS Training Courses. Amadeus Software Ltd

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "SAS Macro. SAS Training Courses. Amadeus Software Ltd"

Transcription

1 SAS Macro SAS Training Courses By Amadeus Software Ltd

2 AMADEUS SOFTWARE LIMITED SAS TRAINING Amadeus have been delivering SAS Training since 1989 and our aim is to provide you with best quality SAS training where, when and how you choose. Delivery Options Available: Public Training On-Site Training On-Demand Training Types of Training Available: Training Courses: Classroom based with a mixture of demonstration sessions and workshop sessions. Each delegate receives a copy of course material which can be used as reference material after the class. Workshops: Classroom based with practical sessions. There will be very little in the way of lecturing; delegates will be expected to actively contribute during the workshop. Written material will be provided to delegates, this material will not be a textbook but a record of the practical steps followed during the workshop. On-Demand: Amadeus On-Demand training is delivered through a web browser to any computer or device with internet access. Training is recorded and conducted by our most experienced instructors using in-depth examples, video demonstrations and animations. RECOMMENDED TRAINING CURRICULUM PATH CONTACT Amadeus Software Limited Mulberry House, 9 Church Green, Witney, Oxon, OX28 4AZ, England. Tel: +44 (0) Web Site:

3 Credits Credits This SAS Software training course was written by Staff of Amadeus Software Ltd. Version 6.3 Copyright Notice Copyright 2013 by Amadeus Software Ltd. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying or otherwise, without prior permission of the publisher, Amadeus Software Ltd, Witney, Oxfordshire, England. Trademark Notice The Amadeus logo is a trademark of Amadeus Software Ltd, Witney, Oxfordshire, England. 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 All other trademarks recognised. Disclaimer These course notes are intended to supplement documentation supplied by SAS Institute, and not to replace it. Where SAS syntax is given here, it may not include all possible options. Similarly, lists of statements, functions, formats, macro variables and other SAS features given here are not intended to be comprehensive. For complete and up-to-date information, please refer to the SAS Institute documentation..

4 Table of Contents Table of Contents M1 INTRODUCTION... Common Coding Tasks... Example 1... Example 2... Example 3... Example 4 (Optional - SAS/Graph users)... General Strategy... Workshop Session... M2 MACRO VARIABLES Automatic Macro Variables... Automatic System Macro Variables... Operating System Dependency... Determining the Values of Macro Variables... Using SASHELP.VMACRO... Using %PUT Statement... Creating User-Defined Macro Variables... %LET Statement... Macro Functions... Optional - SAS/Connect Software Users... Resolution Considerations... Limiting the Extent of Resolution... Multi - Pass Resolution... Rules for Dealing with Multiple Ampersands... Debugging Option - SYMBOLGEN... Macro Variables vs. DATA Step Variables... Workshop Session... M3 MACROS... Definition of a Macro... Macro Definition... Debugging Option MCOMPILENOTE... The Macro Call... Debugging Option MPRINT... Passing Parameters... Positional Parameters... Keyword Parameters... Combination of Positional and Keyword Parameters... Varying Number of Parameters... 1

5 Table of Contents Compilation and Execution Phases... Deleting a Compiled Macro... Other Macro Forms (Optional)... Workshop Session... M4 BEHIND THE SCENES... Symbol Tables Rules... Example 1... Example 2... Example 3... Example 4... Example 5... Example 6... Deleting Macro Variables... Nested Macros... Additional Debugging Options... GLOBAL and LOCAL Variables... Problem 1... Solution to Problem 1... Problem 2... Solution to Problem 2... Creating READONLY Macro Variables... Determining Whether a Macro Variable Exists... Workshop Session... M5 MACRO PROGRAMMING... Directing Macro Execution... Macro Statements... Macro Comments... Conditional Statements... Debugging Option MLOGIC... AND/OR Logical Operators... Evaluating an Item Against a List of Items... Iteration... Conditional Termination of Macro Flow... %RETURN... %ABORT... String Manipulation... %LENGTH... %UPCASE... %SUBSTR... %INDEX... %SCAN... %SYSFUNC, %QSYSFUNC and %SYSCALL... Example 1 Numeric DATA Step Functions... Example 2 Formatting the Text in a TITLE Statement... Example 3 Check for the Existence of a SAS Data Set... Example 4 Formatting the Date in a TITLE Statement... 2

6 Table of Contents Example 5 Moving a Date Forward... Workshop Session... M6 THE DATA STEP INTERFACE... Functions and Call Routines... SYMGET... Dynamic Change to the Macro Variable Name... Call SYMPUT and Call SYMPUTX... Syntax... Combinations of Form... Example 1 - Data Dependent Titles... Example 2 - Triggering a PROC Based on a DATA Step Value... Example 3 - Sub-Setting a Data Set... Creating a Macro Variable from Proc SQL... Workshop Session... M7 HANDLING SPECIAL CHARACTERS Numeric Evaluations... Explicit Evaluation... Numeric Comparison... Implied Evaluation... Automatic Evaluation... to Quoting Functions... Characters and Operators that Can Be Masked... Why are Quoting Functions Called Quoting Functions?... Rescan or No Rescan?... Compile Time or Execution Time?... Example 1 - Using Quoting Functions to Mask Semicolons at Compilation Time... Example 2 - Using Quoting Functions to Mask % and & Characters at Compilation Time... Example 3 - Using Quoting Functions to Mask Mnemonic Operators at Compilation Time... Example 4 - Using Quoting Functions to Mask Mnemonic Operators at Execution Time... Example 5 - Using Quoting Functions to Work with Unbalanced Quotation Marks or Parentheses at Compilation Time... Example 6 - Using Quoting functions to work with Unbalanced Quotation Marks at Compilation and Execution Time... Built-in Quoting... Summary... Comparison of Quoting Functions... Workshop Session... M8 WORKING WITH MACROS... Using the %INCLUDE Statement... The Autocall Library... The Autocall Facility... Aggregate Storage Locations... Enabling Autocall... 3

7 Table of Contents The Supplied Library... The Stored Compiled Macro Facility... Storing Macros as Catalog Source Entries (Optional)... How SAS Resolves Macro Calls... Writing Successful Macros... Modularity... Referencing Environments... Design... Code Layout... Robustness... Documentation... Efficiency... Maintenance... Workshop Session... WORKSHOP SOLUTIONS... M1 Exercise 1... M1 Exercise 2... M1 Exercise 3... M1 Exercise 4... M1 Exercise 5... M2 Exercise 1... M2 Exercise 2... M2 Exercise 3... M2 Exercise 4... M2 Exercise 5... M2 Exercise 6... M2 Exercise 7... M2 Exercise 8... M3 Exercise 1... M3 Exercise 2... M3 Exercise 3... M3 Exercise 4... M3 Exercise 5... M4 Exercise 1... M4 Exercise 2... M4 Exercise 3... M5 Exercise 1... M5 Exercise 2... M5 Exercise 3... M5 Exercise 4... M5 Exercise 5... M5 Exercise 6... M5 Exercise 7... M6 Exercise 1... M6 Exercise 2... M6 Exercise 3... M6 Exercise 4... M6 Exercise 5... M6 Exercise 6... M6 Exercise 7... M7 Exercise 1... M7 Exercise 2... M7 Exercise 3... M7 Exercise

8 Table of Contents M7 Exercise 5... M7 Exercise 6... M7 Exercise 7... M8... 5

9 Table of Contents 6

10 M1 Common Coding Tasks General Strategy Workshop Session 1-1

11 1-2

12 Common Coding Tasks Those with some experience in SAS DATA and procedure step programming may have come across several classic problems during the course of their work. Example 1 How would you include the current date in the title of a report? In order to do so, you would have to be able to write a TITLE statement that could somehow extract the current date from the system clock. Here is a first attempt at a variable title statement: And not surprisingly, the output starts as: Not very successful! 1-3

13 The macro solution: You can use several automatic macro variables. Automatic implies that the macro variable is available to you when you are running SAS programs. Example 2 As a second example, suppose you want to execute some code conditionally, based upon the day of the week. You may want to execute different steps dependent upon the results of tests. The code below will NOT work because step types are being mixed: 1-4

14 You cannot mix DATA steps and PROC steps in a SAS program. They have to be separate and only the macro language can pass values from one step to another. 1-5

15 For example: 1-6

16 Example 3 In this third example, suppose you have a monthly series of twelve files all to be run with the same report. In this case our 'wrong' attempt may look something like: Here we are assuming our twelve SAS data sets are called MDATA.DS_1 to MDATA.DS_12. This again, will not work because of the attempt to mix steps. We could write 12 individual Proc TABULATE steps however. This alternative solution creates a bundle of code called a macro which will pass a different value to the Proc TABULATE code each time round the loop. 1-7

17 Example 4 (Optional - SAS/Graph users) The fourth example again shows data dependency. Suppose we wish to plot some data and place across it a reference line whose value is dependent on the data. The data set used in the next example is the EPIDEMIC data set. This contains the number of influenza cases reported per week for five age ranges of the population (categories A to E). For category A we wish to plot the number of reported cases against the date (in this case a running week number), but to place across the plot a reference line referring to the average number of cases reported over the period. Our attempt may look like this: Here the intermediate SAS data set called NEWDATA contains the variable AVNUM for all observations, but unfortunately a syntax error results as the VREF option demands an explicit value. 1-8

18 Here is the syntax error caused by using a variable name with the VREF option: Macro again can offer us a solution as a macro variable can resolve to an explicit value. 1-9

19 1-10

20 General Strategy By now you will have noticed the key symbols within the macro language are the ampersand (&) and the percent sign (%). Before we look at the effect of these two symbols, let us consider the progress of a normal DATA step program. This program has one step; a DATA step. The SAS Supervisor places all of these statements in a program input stack, takes one word at a time from the stack and passes them to the SAS compiler or procedure parser (if the step is a proc). At the end of the statement when a semi-colon is reached the statement is checked for syntax. At a step boundary, this process is halted and the step is compiled or parsed, then executed. TOP OF STACK data defines a step boundary run defines a step boundary data new_demog; set mdata.demog; if age > 35 then newsal=salary*1.05; else newsal=salary*1.01; run; 1-11

21 A SAS program is simply a sequence of DATA and PROC steps Each step is delimited by the keywords such as: DATA PROC RUN QUIT ENDSAS A 'word' (or 'token') at a time is transferred to the DATA step compiler or procedure parser. TOP OF STACK data defines a step boundary run defines a step boundary data new_demog; set mdata.demog; if age > 35 then newsal=salary*1.05; else newsal=salary*1.01; run; SAS SUPERVISOR SAS Compiler or Procedure Parser data First Token passed through data new_demog Next Token passed through data new_demog; Checked for Syntax 1-12

22 TOP OF STACK data defines a step boundary run defines a step boundary data new_demog; set mdata.demog; if age > 35 then newsal=salary*1.05; else newsal=salary*1.01; run; SAS SUPERVISOR SAS Compiler or Procedure Parser data new_demog; set and so on, until the RUN; step boundary is found. Upon a step boundary, the SAS Supervisor suspends processing the SAS statements and the completed step is compiled (or parsed in the case of a procedure) and then executed. Each step independently compiles (parses) and then executes. 1-13

23 A SAS program is, and can only be, a series of DATA and PROC steps plus any global statements. The role of Macro is simply to generate code that is to be put on top of the program input stack. TOP OF STACK &sysdate"; proc print data=mdata.policies; var polnum policy; where type='life'; run; SAS SUPERVISOR MACRO SAS Compiler or Procedure Parser title "Job run on The presence of the & followed by a non-blank character triggers the macro facility. The token is passed to the macro facility, which substitutes a value on the input stack. 1-14

24 The value of the macro variable is retrieved by the macro facility and placed on the input stack: TOP OF STACK 26JUN17"; proc print data=mdata.policies; var polnum policy; where type='life'; run; SAS SUPERVISOR MACRO SAS Compiler or Procedure Parser title "Job run on Whereupon, the replaced code is treated as normal: TOP OF STACK "; proc print data=mdata.policies; var polnum policy; where type='life'; run; SAS SUPERVISOR MACRO SAS Compiler or Procedure Parser title "Job run on 26JUN

25 So, the SAS macro facility is concerned with extending and customising the SAS language. It gives users the ability to: Generate code dynamically; Handle text string substitution within code; Enable repeated execution of code bundles; Use conditional logic to execute code. It should be stressed that the SAS macro facility will not enable SAS code to run quicker, but rather produce SAS programs that are potentially re-usable, dynamic and can be maintained more easily. 1-16

SAS Macro Language: Reference

SAS Macro Language: Reference SAS Macro Language: Reference INTRODUCTION Getting Started with the Macro Facility This is the macro facility language reference for the SAS System. It is a reference for the SAS macro language processor

More information

Base and Advance SAS

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

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Contents Part 1 Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Macro Basics Chapter 1 Introduction 3 1.1 Macro Facility Overview 3 1.2 Terminology

More information

SAS CURRICULUM. BASE SAS Introduction

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

More About SAS Macros

More About SAS Macros More About SAS Macros (Than You Thought Possible) Donald P. Gallogly DCBS IMD Topics The SAS Macros System Macro Variables Writing Macros The SAS Macros System The SAS Macros System SAS macros and macro

More information

Advanced Macro Topics Steven First, Systems Seminar Consultants, Madison, WI

Advanced Macro Topics Steven First, Systems Seminar Consultants, Madison, WI Paper 19-26 Advanced Macro Topics Steven First, Systems Seminar Consultants, Madison, WI Abstract The SAS macro language continues to be an integral part of the SAS system, and can be a wonderful tool

More information

title1 "Visits at &string1"; proc print data=hospitalvisits; where sitecode="&string1";

title1 Visits at &string1; proc print data=hospitalvisits; where sitecode=&string1; PharmaSUG 2012 Paper TF01 Macro Quoting to the Rescue: Passing Special Characters Mary F. O. Rosenbloom, Edwards Lifesciences LLC, Irvine, CA Art Carpenter, California Occidental Consultants, Anchorage,

More information

Foundations and Fundamentals. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc.

Foundations and Fundamentals. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc. SAS System Options: The True Heroes of Macro Debugging Kevin Russell and Russ Tyndall, SAS Institute Inc., Cary, NC ABSTRACT It is not uncommon for the first draft of any macro application to contain errors.

More information

SAS Certification Handout #11: Adv. Prog. Ch. 9-10

SAS Certification Handout #11: Adv. Prog. Ch. 9-10 SAS Certification Handout #11: Adv. Prog. Ch. 9-10 /************ Ch. 9 ********************/ /* SAS Macros -- like writing your own functions in SAS; especially useful for reproducing analyses or reports

More information

Macro Basics. Introduction. Defining and Using Macro Variables. Defining and Using Macros. Macro Parameters. Part 1. Chapter 1. Chapter 2.

Macro Basics. Introduction. Defining and Using Macro Variables. Defining and Using Macros. Macro Parameters. Part 1. Chapter 1. Chapter 2. Part 1 Macro Basics Chapter 1 Chapter 2 Chapter 3 Chapter 4 Introduction Defining and Using Macro Variables Defining and Using Macros Macro Parameters 2 Carpenter s Complete Guide to the SAS Macro Language

More information

My Enterprise Guide David Shannon, Amadeus Software Limited, UK

My Enterprise Guide David Shannon, Amadeus Software Limited, UK Paper 169-31 My Enterprise Guide David Shannon, Amadeus Software Limited, UK ABSTRACT Following on from My Computer and My Documents, users of SAS can now also have My Enterprise Guide! The aim of this

More information

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates &&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates INTRODUCTION SAS macros are powerful tools that can create reusable code modules to do a variety of programming

More information

Unlock SAS Code Automation with the Power of Macros

Unlock SAS Code Automation with the Power of Macros SESUG 2015 ABSTRACT Paper AD-87 Unlock SAS Code Automation with the Power of Macros William Gui Zupko II, Federal Law Enforcement Training Centers SAS code, like any computer programming code, seems to

More information

Macro Internals for the User Developer s Overview. Susan O Connor, SAS Institute Inc., Cary, NC

Macro Internals for the User Developer s Overview. Susan O Connor, SAS Institute Inc., Cary, NC Macro Internals for the User Developer s Overview Susan O Connor, SAS Institute Inc., Cary, NC ABSTRACT You have used the macro language software that is part of base software from SAS Institute Inc. or

More information

The Ins and Outs of %IF

The Ins and Outs of %IF Paper 1135-2017 The Ins and Outs of %IF M. Michelle Buchecker, ThotWave Technologies, LLC. ABSTRACT Have you ever had your macro code not work and you couldn't figure out why? Even something as simple

More information

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, School of Public Health

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, School of Public Health AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike Zdeb, University@Albany School of Public Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason

More information

A Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX

A Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX South Central SAS Users Group 2016 A Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX ABSTRACT SAS Macros are a useful tool to any SAS Programmer. A macro variable can be used

More information

An Animated Guide: An Introduction to SAS Macro Quoting Russ Lavery Bryn Mawr, PA

An Animated Guide: An Introduction to SAS Macro Quoting Russ Lavery Bryn Mawr, PA An Animated Guide: An Introduction to SAS Macro Quoting Russ Lavery Bryn Mawr, PA Figure 1 ABSTRACT This paper builds on a NESUG 2002 paper that described the general functioning of the SAS Macro Processor.

More information

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA PharmaSUG 2017 BB07 Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT One often uses an iterative %DO loop to execute a section of a macro

More information

An Introduction to Macros Deb Cassidy

An Introduction to Macros Deb Cassidy Paper #HW03 An Introduction to Macros Deb Cassidy Abstract A search in the proceedings for SUGI 24-28 for the word "macro" had over 1,000 hits. Why are macros so popular? A quick glance through the papers

More information

A Tutorial on the SAS Macro Language

A Tutorial on the SAS Macro Language HW152 SESUG 2015 A Tutorial on the SAS Macro Language John J. Cohen, Advanced Data Concepts LLC, Newark, DE ABSTRACT The SAS Macro language is another language that rests on top of regular SAS code. If

More information

Contents. About This Book...1

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

STATION

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

Tired of CALL EXECUTE? Try DOSUBL

Tired of CALL EXECUTE? Try DOSUBL ABSTRACT SESUG Paper BB-132-2017 Tired of CALL EXECUTE? Try DOSUBL Jueru Fan, PPD, Morrisville, NC DOSUBL was first introduced as a function in SAS V9.3. It enables the immediate execution of SAS code

More information

Paper 149 JAY A. JAFFE

Paper 149 JAY A. JAFFE SAS MACROS BEYOND THE BASICS JAY A. JAFFE So you got some %LET statements, some &symbols, and maybe some %MACROs that help you do your work? Let s go ahead and leverage the full power of the SAS Macro

More information

UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing: A preprocessor may allow a

More information

Seminar Series: CTSI Presents

Seminar Series: CTSI Presents Biostatistics, Epidemiology & Research Design (BERD) Howard Cabral, PhD, MPH Christine Chaisson, MPH Seminar Series: CTSI Presents November 20, 2014 Demystifying SAS Macros BUSPH Data Coordinating Center

More information

Contents. Overview How SAS processes programs Compilation phase Execution phase Debugging a DATA step Testing your programs

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

SAS Macro Programming Tips and Techniques

SAS Macro Programming Tips and Techniques PharmaSUG 2012 Paper HW05 SAS Macro Programming Tips and Techniques Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Abstract The SAS Macro Language is a powerful feature

More information

Lesson 1: Writing Your First JavaScript

Lesson 1: Writing Your First JavaScript JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

SOS (Save Our Space) Matters of Size

SOS (Save Our Space) Matters of Size SOS (Save Our Space) Matters of Size By Matthew Pearce Amadeus Software Limited 2001 Abstract Disk space is one of the most critical issues when handling large amounts of data. Large data means greater

More information

Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA

Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA PharmaSUG2011 - Paper AD19 Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA ABSTRACT In Seattle at the PharmaSUG 2000 meeting the Symbol Table Generator was first

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

The SAS Interface to REXX

The SAS Interface to REXX 95 CHAPTER 9 The SAS Interface to REXX Overview 95 The Subcommand Environment 96 Retrieving and Assigning the Values of REXX Variables in a SAS Program 97 Using the GETEXEC DATA Step Function 97 Using

More information

Functions vs. Macros: A Comparison and Summary

Functions vs. Macros: A Comparison and Summary Functions vs. Macros: A Comparison and Summary Mahipal Vanam Phaneendhar Vanam Srinivas Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT SAS is rich in various built-in functions, and predefined

More information

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

Arthur L. Carpenter California Occidental Consultants, Oceanside, California Paper 028-30 Storing and Using a List of Values in a Macro Variable Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT When using the macro language it is not at all

More information

Syntactic Analysis. CS345H: Programming Languages. Lecture 3: Lexical Analysis. Outline. Lexical Analysis. What is a Token? Tokens

Syntactic Analysis. CS345H: Programming Languages. Lecture 3: Lexical Analysis. Outline. Lexical Analysis. What is a Token? Tokens Syntactic Analysis CS45H: Programming Languages Lecture : Lexical Analysis Thomas Dillig Main Question: How to give structure to strings Analogy: Understanding an English sentence First, we separate a

More information

Lexical analysis. Syntactical analysis. Semantical analysis. Intermediate code generation. Optimization. Code generation. Target specific optimization

Lexical analysis. Syntactical analysis. Semantical analysis. Intermediate code generation. Optimization. Code generation. Target specific optimization Second round: the scanner Lexical analysis Syntactical analysis Semantical analysis Intermediate code generation Optimization Code generation Target specific optimization Lexical analysis (Chapter 3) Why

More information

Compiler, Assembler, and Linker

Compiler, Assembler, and Linker Compiler, Assembler, and Linker Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr What is a Compilation? Preprocessor Compiler Assembler Linker Loader Contents

More information

Compiler Design. Subject Code: 6CS63/06IS662. Part A UNIT 1. Chapter Introduction. 1.1 Language Processors

Compiler Design. Subject Code: 6CS63/06IS662. Part A UNIT 1. Chapter Introduction. 1.1 Language Processors Compiler Design Subject Code: 6CS63/06IS662 Part A UNIT 1 Chapter 1 1. Introduction 1.1 Language Processors A compiler is a program that can read a program in one language (source language) and translate

More information

EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing. Görel Hedin Revised:

EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing. Görel Hedin Revised: EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing Görel Hedin Revised: 2017-09-04 This lecture Regular expressions Context-free grammar Attribute grammar

More information

New Macro Features Added in SAS 9.3 and SAS 9.4

New Macro Features Added in SAS 9.3 and SAS 9.4 SAS1575-2015 New Macro Features Added in SAS 9.3 and SAS 9.4 Richard D. Langston, SAS Institute Inc. ABSTRACT This paper describes the new features added to the macro facility in SAS 9.3 and SAS 9.4. New

More information

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority SAS 101 Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23 By Tasha Chapman, Oregon Health Authority Topics covered All the leftovers! Infile options Missover LRECL=/Pad/Truncover

More information

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.

ADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine. 1 PL/SQL INTRODUCTION SQL does not have procedural capabilities. SQL does not provide the programming techniques of condition checking, looping and branching that is required for data before permanent

More information

Applications Development. Paper 37-27

Applications Development. Paper 37-27 Paper 37-27 Combining Pattern-Matching And File I/O Functions: A SAS Macro To Generate A Unique Variable Name List Michael P.D. Bramley, Venturi Technology Partners, Waukegan, IL ABSTRACT When a large

More information

Submitting SAS Code On The Side

Submitting SAS Code On The Side ABSTRACT PharmaSUG 2013 - Paper AD24-SAS Submitting SAS Code On The Side Rick Langston, SAS Institute Inc., Cary NC This paper explains the new DOSUBL function and how it can submit SAS code to run "on

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG

SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG Paper SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG Qixuan Chen, University of Michigan, Ann Arbor, MI Brenda Gillespie, University of Michigan, Ann Arbor, MI ABSTRACT This paper

More information

Eclipse Support for Using Eli and Teaching Programming Languages

Eclipse Support for Using Eli and Teaching Programming Languages Electronic Notes in Theoretical Computer Science 141 (2005) 189 194 www.elsevier.com/locate/entcs Eclipse Support for Using Eli and Teaching Programming Languages Anthony M. Sloane 1,2 Department of Computing

More information

An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI

An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI Paper 153-26 An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI Abstract The SAS programming language has a rich tool-box of features that can offer a lot of power to

More information

DATA Step Debugger APPENDIX 3

DATA Step Debugger APPENDIX 3 1193 APPENDIX 3 DATA Step Debugger Introduction 1194 Definition: What is Debugging? 1194 Definition: The DATA Step Debugger 1194 Basic Usage 1195 How a Debugger Session Works 1195 Using the Windows 1195

More information

Dequote me on that: Using the dequote function to add some friendliness to SAS macros

Dequote me on that: Using the dequote function to add some friendliness to SAS macros Paper CC02 Dequote me on that: Using the dequote function to add some friendliness to SAS macros John Hendrickx, Danone Nutricia Research, Utrecht, The Netherlands ABSTRACT SAS macros need to be user-friendly

More information

CS664 Compiler Theory and Design LIU 1 of 16 ANTLR. Christopher League* 17 February Figure 1: ANTLR plugin installer

CS664 Compiler Theory and Design LIU 1 of 16 ANTLR. Christopher League* 17 February Figure 1: ANTLR plugin installer CS664 Compiler Theory and Design LIU 1 of 16 ANTLR Christopher League* 17 February 2016 ANTLR is a parser generator. There are other similar tools, such as yacc, flex, bison, etc. We ll be using ANTLR

More information

Data Collections. Welcome to the Fourth Dimension (and beyond) Martin Phillips Ladybridge Systems Ltd. International Spectrum Conference, 2014

Data Collections. Welcome to the Fourth Dimension (and beyond) Martin Phillips Ladybridge Systems Ltd. International Spectrum Conference, 2014 Data Collections Welcome to the Fourth Dimension (and beyond) International Spectrum Conference, 2014 Martin Phillips Ladybridge Systems Ltd Multivalue Are we at its limits? We all understand the power

More information

SAS/FSP 9.2. Procedures Guide

SAS/FSP 9.2. Procedures Guide SAS/FSP 9.2 Procedures Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2008. SAS/FSP 9.2 Procedures Guide. Cary, NC: SAS Institute Inc. SAS/FSP 9.2 Procedures

More information

Lecture Notes on Top-Down Predictive LL Parsing

Lecture Notes on Top-Down Predictive LL Parsing Lecture Notes on Top-Down Predictive LL Parsing 15-411: Compiler Design Frank Pfenning Lecture 8 1 Introduction In this lecture we discuss a parsing algorithm that traverses the input string from l eft

More information

Normalization Rules 1

Normalization Rules 1 Normalization Rules 1 Copyright Statement All of the information and material inclusive of text, images, logos, product names is either the property of, or used with permission by Ex Libris Ltd. The information

More information

Overview of the Ruby Language. By Ron Haley

Overview of the Ruby Language. By Ron Haley Overview of the Ruby Language By Ron Haley Outline Ruby About Ruby Installation Basics Ruby Conventions Arrays and Hashes Symbols Control Structures Regular Expressions Class vs. Module Blocks, Procs,

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

IS12 - Introduction to Programming. Lecture 7: Introduction to C

IS12 - Introduction to Programming. Lecture 7: Introduction to C IS12 - Introduction to Programming Lecture 7: Introduction to C Peter Brusilovsky http://www2.sis.pitt.edu/~peterb/0012-072/ Lecture 7: Introduction to C. Overview C vs. other languages Information representation

More information

SAS/IntrNet 9.2. Overview. SAS Documentation

SAS/IntrNet 9.2. Overview. SAS Documentation SAS/IntrNet 9.2 Overview SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2008. SAS/IntrNet 9.2: Overview. Cary, NC: SAS Institute Inc. SAS/IntrNet

More information

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

SAS Studio: A New Way to Program in SAS

SAS Studio: A New Way to Program in SAS SAS Studio: A New Way to Program in SAS Lora D Delwiche, Winters, CA Susan J Slaughter, Avocet Solutions, Davis, CA ABSTRACT SAS Studio is an important new interface for SAS, designed for both traditional

More information

Macros are a block of code that can be executed/called on demand

Macros are a block of code that can be executed/called on demand What Are These Macros are a block of code that can be executed/called on demand Global variables are variables that you assign a value to, which can be referenced anywhere within your program. (Leah s

More information

OPENEDGE TRAINING SYNOPSES course synopses for OpenEdge Training.

OPENEDGE TRAINING SYNOPSES course synopses for OpenEdge Training. OPENEDGE TRAINING SYNOPSES 2013 course synopses for OpenEdge Training. CONTENTS DEVELOPMENT AND PROGRAMMING OpenEdge Programming with a Character UI... 3 Persistence and Named Events... 4 Dynamic Query

More information

We use L i to stand for LL L (i times). It is logical to define L 0 to be { }. The union of languages L and M is given by

We use L i to stand for LL L (i times). It is logical to define L 0 to be { }. The union of languages L and M is given by The term languages to mean any set of string formed from some specific alphaet. The notation of concatenation can also e applied to languages. If L and M are languages, then L.M is the language consisting

More information

Using X-Particles with Team Render

Using X-Particles with Team Render Using X-Particles with Team Render Some users have experienced difficulty in using X-Particles with Team Render, so we have prepared this guide to using them together. Caching Using Team Render to Picture

More information

CS131 Compilers: Programming Assignment 2 Due Tuesday, April 4, 2017 at 11:59pm

CS131 Compilers: Programming Assignment 2 Due Tuesday, April 4, 2017 at 11:59pm CS131 Compilers: Programming Assignment 2 Due Tuesday, April 4, 2017 at 11:59pm Fu Song 1 Policy on plagiarism These are individual homework. While you may discuss the ideas and algorithms or share the

More information

MICROSOFT OFFICE SPECIALIST EXCEL/POWERPOINTSTUDY PREP Course Syllabus

MICROSOFT OFFICE SPECIALIST EXCEL/POWERPOINTSTUDY PREP Course Syllabus 6111 E. Skelly Drive P. O. Box 477200 Tulsa, OK 74147-7200 MICROSOFT OFFICE SPECIALIST EXCEL/POWERPOINTSTUDY PREP Course Syllabus Course Number: BMA-0226 OHLAP Credit: No OCAS Code: 9228 Course Length:

More information

Oracle Database: Introduction to SQL Ed 2

Oracle Database: Introduction to SQL Ed 2 Oracle University Contact Us: +40 21 3678820 Oracle Database: Introduction to SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database 12c: Introduction to SQL training helps you write subqueries,

More information

Lecture Notes on Shift-Reduce Parsing

Lecture Notes on Shift-Reduce Parsing Lecture Notes on Shift-Reduce Parsing 15-411: Compiler Design Frank Pfenning, Rob Simmons, André Platzer Lecture 8 September 24, 2015 1 Introduction In this lecture we discuss shift-reduce parsing, which

More information

IV-4Macros. Chapter IV-4

IV-4Macros. Chapter IV-4 Chapter IV-4 IV-4Macros Overview... 108 Comparing Macros and Functions... 108 Macro Syntax... 110 The Defining Keyword... 110 The Procedure Name... 110 The Procedure Subtype... 110 The Parameter List and

More information

For OS/390, VM, VSE. User Guide 6.2 SP3

For OS/390, VM, VSE. User Guide 6.2 SP3 For OS/390, VM, VSE User Guide 6.2 SP3 Release 6.2, May 1996 Updated: April 1999 This documentation and related computer software program (hereinafter referred to as the Documentation ) is for the end

More information

Object-Oriented Principles and Practice / C++

Object-Oriented Principles and Practice / C++ Object-Oriented Principles and Practice / C++ Alice E. Fischer April 20, 2015 OOPP / C++ Lecture 3... 1/23 New Things in C++ Object vs. Pointer to Object Optional Parameters Enumerations Using an enum

More information

WebLearning IBM Curriculum

WebLearning IBM Curriculum WebLearning IBM Curriculum WebSphere Commerce Suite Marketplace Edition Implementation Table of Contents: Overview Who Should Take This Course What You Are Taught Topics Include Prerequisites Duration:

More information

Learn to Please: Creating SAS Programs for Others

Learn to Please: Creating SAS Programs for Others Paper 0872-2017 Learn to Please: Creating SAS Programs for Others Peter Crawford, Crawford Software Consultancy Limited ABSTRACT Programming for others involves new disciplines not called for when we write

More information

Storing and Reusing Macros

Storing and Reusing Macros 101 CHAPTER 9 Storing and Reusing Macros Introduction 101 Saving Macros in an Autocall Library 102 Using Directories as Autocall Libraries 102 Using SAS Catalogs as Autocall Libraries 103 Calling an Autocall

More information

BreakOnWord: A Macro for Partitioning Long Text Strings at Natural Breaks Richard Addy, Rho, Chapel Hill, NC Charity Quick, Rho, Chapel Hill, NC

BreakOnWord: A Macro for Partitioning Long Text Strings at Natural Breaks Richard Addy, Rho, Chapel Hill, NC Charity Quick, Rho, Chapel Hill, NC PharmaSUG 2014 - Paper CC20 BreakOnWord: A Macro for Partitioning Long Text Strings at Natural Breaks Richard Addy, Rho, Chapel Hill, NC Charity Quick, Rho, Chapel Hill, NC ABSTRACT Breaking long text

More information

Using PROC FCMP to the Fullest: Getting Started and Doing More

Using PROC FCMP to the Fullest: Getting Started and Doing More Paper HT02-2013 Using PROC FCMP to the Fullest: Getting Started and Doing More Arthur L. Carpenter California Occidental Consultants, Anchorage, AK ABSTRACT The FCMP procedure is used to create user defined

More information

Incident Tracking Reference Guide

Incident Tracking Reference Guide Incident Tracking Reference Guide Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Diversified Computer Corp. All rights reserved. No part of this publication may be reproduced, photocopied, stored

More information

1st4sport Functional Skills in Mathematics at Level 1

1st4sport Functional Skills in Mathematics at Level 1 1st4sport Functional Skills in Mathematics at Level 1 Qualification Specification Qualification Overview: This qualification is designed to provide learners with the opportunity to develop skills and knowledge

More information

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008 Course Syllabus Course Title: Compiler Construction Course Level: 4 Lecture Time: Course

More information

Radware. Training Policies V001.70

Radware. Training Policies V001.70 Radware Training Policies V001.70 TABLE OF CONTENTS SCOPE & DISCLAIMER...3 QUESTIONS?...3 TRAINING...4 OVERVIEW... 4 DELIVERY OPTIONS... 4 TRAINING ENROLLMENT & REGISTRATION... 5 COURSE EVALUATION... 5

More information

The DATA Statement: Efficiency Techniques

The DATA Statement: Efficiency Techniques The DATA Statement: Efficiency Techniques S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT One of those SAS statements that everyone learns in the first day of class, the DATA statement rarely gets

More information

ABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE

ABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE Paper SA06 Painless Extraction: Options and Macros with PROC PRESENV Keith Fredlund, MS (candidate) Grand Valley State University, Allendale, Michigan; Thinzar Wai, MS (candidate) Grand Valley State University,

More information

Argyll client area user guide

Argyll client area user guide Argyll client area user guide V 1.5 October 2011 Argyll Environmental Limited Lees House 21-23 Dyke Road Brighton, BN1 3FE Tel: 0845 458 5250 Fax: 0845 458 5260 www.argyllenvironmental.com Company No.

More information

SAS Macros Advanced Techniques

SAS Macros Advanced Techniques Paper 1476-2017 SAS Macros Advanced Techniques Author Dari Mazloom, USAA ABSTRACT The SAS macro language provides a powerful tool to write a program once and re-use it many times in multiple places. A

More information

Oracle Database: Program with PL/SQL Ed 2

Oracle Database: Program with PL/SQL Ed 2 Oracle University Contact Us: +38 61 5888 820 Oracle Database: Program with PL/SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database: Program with PL/SQL training starts with an introduction

More information

Fifteen Functions to Supercharge Your SAS Code

Fifteen Functions to Supercharge Your SAS Code MWSUG 2017 - Paper BB071 Fifteen Functions to Supercharge Your SAS Code Joshua M. Horstman, Nested Loop Consulting, Indianapolis, IN ABSTRACT The number of functions included in SAS software has exploded

More information

Using an LALR(1) Parser Generator

Using an LALR(1) Parser Generator Using an LALR(1) Parser Generator Yacc is an LALR(1) parser generator Developed by S.C. Johnson and others at AT&T Bell Labs Yacc is an acronym for Yet another compiler compiler Yacc generates an integrated

More information

LL(k) Parsing. Predictive Parsers. LL(k) Parser Structure. Sample Parse Table. LL(1) Parsing Algorithm. Push RHS in Reverse Order 10/17/2012

LL(k) Parsing. Predictive Parsers. LL(k) Parser Structure. Sample Parse Table. LL(1) Parsing Algorithm. Push RHS in Reverse Order 10/17/2012 Predictive Parsers LL(k) Parsing Can we avoid backtracking? es, if for a given input symbol and given nonterminal, we can choose the alternative appropriately. his is possible if the first terminal of

More information

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14 213 CHAPTER 14 Macro Facility About the Macro Facility 213 Automatic Macro Variables 213 Macro Statements 215 Macro Functions 215 SAS System Options Used by the Macro Facility 216 Using Autocall Libraries

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

Course Details. Skills Gained. Who Can Benefit. Prerequisites. View Online URL:

Course Details. Skills Gained. Who Can Benefit. Prerequisites. View Online URL: Specialized - Mastering jquery Code: Lengt h: URL: TT4665 4 days View Online Mastering jquery provides an introduction to and experience working with the JavaScript programming language in the environment

More information

Assembly Language Programming

Assembly Language Programming Experiment 3 Assembly Language Programming Every computer, no matter how simple or complex, has a microprocessor that manages the computer s arithmetical, logical and control activities. A computer program

More information

UNIT -2 LEXICAL ANALYSIS

UNIT -2 LEXICAL ANALYSIS OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce

More information