Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo
SAS 9.4 Macro Language, 2nd Edition

Book Description

Explains how to increase the modularity, flexibility, and maintainability of your SAS code using the SAS macro facility. Provides complete information about macro language elements, interfaces between the SAS macro facility and other parts of SAS software, and macro processing in general.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. About This Book
  5. What’s New in the SAS 9.4 Macro Facility
  6. Recommended Reading
  7. Part 1: Understanding and Using the Macro Facility
    1. Chapter 1: Introduction to the Macro Facility
      1. Getting Started with the Macro Facility
      2. Replacing Text Strings Using Macro Variables
      3. Generating SAS Code Using Macros
      4. More Advanced Macro Techniques
      5. Other Features of the Macro Language
    2. Chapter 2: SAS Programs and Macro Processing
      1. SAS Programs and Macro Processing
      2. How SAS Processes Statements without Macro Activity
      3. How SAS Processes Statements with Macro Activity
    3. Chapter 3: Macro Variables
      1. Macro Variables
      2. Macro Variables Defined by the Macro Processor
      3. Macro Variables Defined by Users
      4. Using Macro Variables
      5. Displaying Macro Variable Values
      6. Referencing Macro Variables Indirectly
      7. Manipulating Macro Variable Values with Macro Functions
    4. Chapter 4: Macro Processing
      1. Macro Processing
      2. Defining and Calling Macros
      3. How the Macro Processor Compiles a Macro Definition
      4. How the Macro Processor Executes a Compiled Macro
      5. Summary of Macro Processing
    5. Chapter 5: Scopes of Macro Variables
      1. Scopes of Macro Variables
      2. Global Macro Variables
      3. Local Macro Variables
      4. Writing the Contents of Symbol Tables to the SAS Log
      5. How Macro Variables Are Assigned and Resolved
      6. Examples of Macro Variable Scopes
      7. Special Cases of Scope with the CALL SYMPUT Routine
    6. Chapter 6: Macro Expressions
      1. Macro Expressions
      2. Defining Arithmetic and Logical Expressions
      3. How the Macro Processor Evaluates Arithmetic Expressions
      4. How the Macro Processor Evaluates Logical Expressions
    7. Chapter 7: Macro Quoting
      1. Macro Quoting
      2. Deciding When to Use a Macro Quoting Function and Which Function to Use
      3. %STR and %NRSTR Functions
      4. %BQUOTE and %NRBQUOTE Functions
      5. Referring to Already Quoted Variables
      6. Deciding How Much Text to Mask with a Macro Quoting Function
      7. %SUPERQ Function
      8. Summary of Macro Quoting Functions and the Characters That They Mask
      9. Unquoting Text
      10. How Macro Quoting Works
      11. Other Functions That Perform Macro Quoting
    8. Chapter 8: Interfaces with the Macro Facility
      1. Interfaces with the Macro Facility
      2. DATA Step Interfaces
      3. Using SAS Language Functions in the DATA Step and Macro Facility
      4. Interfaces with the SQL Procedure
      5. Interfaces with the SAS Component Language
      6. SAS/CONNECT Interfaces
    9. Chapter 9: Storing and Reusing Macros
      1. Storing and Reusing Macros
      2. Saving Macros in an Autocall Library
      3. Saving Macros Using the Stored Compiled Macro Facility
    10. Chapter 10: Macro Facility Error Messages and Debugging
      1. General Macro Debugging Information
      2. Troubleshooting Your Macros
      3. Debugging Techniques
    11. Chapter 11: Writing Efficient and Portable Macros
      1. Writing Efficient and Portable Macros
      2. Keeping Efficiency in Perspective
      3. Writing Efficient Macros
      4. Writing Portable Macros
    12. Chapter 12: Macro Language Elements
      1. Macro Language Elements
      2. Macro Statements
      3. Macro Functions
      4. Automatic Macro Variables
      5. Interfaces with the Macro Facility
      6. Selected Autocall Macros Provided with SAS Software
      7. Selected System Options Used in the Macro Facility
  8. Part 2: Macro Language Dictionary
    1. Chapter 13: AutoCall Macros
      1. AutoCall Macros
      2. Dictionary
    2. Chapter 14: Automatic Macro Variables
      1. Automatic Macro Variables
      2. Dictionary
    3. Chapter 15: DATA Step Call Routines for Macros
      1. DATA Step Call Routines for Macros
      2. Dictionary
    4. Chapter 16: DATA Step Functions for Macros
      1. DATA Step Functions for Macros
      2. Dictionary
    5. Chapter 17: Macro Functions
      1. Macro Functions
      2. Dictionary
    6. Chapter 18: SQL Clauses for Macros
      1. SQL Clauses for Macros
      2. Dictionary
    7. Chapter 19: Macro Statements
      1. Macro Statements
      2. Dictionary
    8. Chapter 20: System Options for Macros
      1. System Options for Macros
      2. Dictionary
  9. Part 3: Appendixes
    1. Appendix 1: Reserved Words in the Macro Facility
      1. Macro Facility Word Rules
      2. Reserved Words
    2. Appendix 2: SAS Tokens
      1. SAS Tokens
      2. List of Tokens
    3. Appendix 3: Syntax for Selected Functions Used with the %SYSFUNC Function
      1. Summary Descriptions and Syntax
      2. Functions and Arguments for %SYSFUNC
  10. Glossary
  11. Index
  12. Footnotes
    1. Chapter 19 Macro Statements