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 Macro Language Magic

Book Description

SAS Macro Language Magic: Discovering Advanced Techniques pushes the SAS macro language to the limit. It explores how even common tools, when used to their full advantage, can transform into amazing applications.

Discover and develop powerful programming techniques down the path to demystifying MACROS. All the tricks and secrets are revealed, enabling you to write SAS macros that work like MAGIC.

Table of Contents

  1. About This Book
  2. About The Authors
  3. Acknowledgments
  4. Part 1: Preparation
    1. Chapter 1: SAS Language Preparation
      1. 1.1 Keep It Simple
      2. 1.2 Keep Up with the Software
      3. 1.3 Experiment
    2. Chapter 2: Shifting Gears: Macro Language
  5. Part 2: Technique
    1. Chapter 3: CALL EXECUTE
      1. 3.1 Basic Rules
      2. 3.2 Achieving the Impossible
      3. 3.3 Multiple CALL EXECUTEs
      4. 3.4 Finally, the Intricacies
      5. 3.5 Execute an Experiment
      6. 3.6 The Final Intricacy: Macro Variable Resolution
    2. Chapter 4: %SYSFUNC
      1. 4.1 Basic Examples
      2. 4.2 Capturing the Program Name
      3. 4.3 Commas and Nested %SYSFUNCs
      4. 4.4 Achieving the Impossible, Revisited
      5. 4.5 Capturing Option Settings
      6. 4.6 Efficiency Considerations
      7. 4.7 A Final Example: ZIP Codes
    3. Chapter 5: CALL SYMPUT
      1. 5.1 Leading and Trailing Blanks
      2. 5.2 A Similar Lesson, Using Recursion
      3. 5.3 Test Your Skill
      4. 5.4 Function Shifts in the Real World
      5. 5.5 A Key Issue: Extra Blanks
    4. Chapter 6: INTO
      1. 6.1 SELECT Executes Immediately
      2. 6.2 Numeric-to-Character Conversion
      3. 6.3 SELECTing Multiple Values
      4. 6.4 DISTINCT Differences
      5. 6.5 How Many Macro Variables?
      6. 6.6 Zero Incoming Observations
      7. 6.7 An Unusual Application: Separated by Else
      8. 6.8 Dictionary Tables
      9. 6.9 Extremely Long Lists
      10. 6.10 Blanks vs. Nulls
    5. Chapter 7: Macro Quoting
      1. 7.1 Why Quoting is Necessary
      2. 7.2 Why Quoting is a Nightmare
      3. 7.3 What Quoting Really Does
      4. 7.4 Peeking Inside the Black Box of Quoting
      5. 7.5 The Final Word on Quoting
    6. Chapter 8: %LOCAL vs. %GLOBAL
      1. 8.1 Why Think %Locally?
      2. 8.2 Creating Symbol Tables and Macro Variables
      3. 8.3 Symbol Tables with CALL SYMPUT
      4. 8.4 Symbol Tables with CALL SYMPUTX
      5. 8.5 Choosing the Source Table
      6. 8.6 A Persisting Impact
    7. Chapter 9: Arithmetic
      1. 9.1 Basic Rules
      2. 9.2 Truth in Numbers, Expressions, and Comparisons
  6. Part 3: Execution
    1. Chapter 10: Generating Text
      1. 10.1 Utilizing Generated Text
      2. 10.2 Counting Words in a String
      3. 10.3 Working with Lists
      4. 10.4 Prefer the Macro Solution
    2. Chapter 11: Debugging
      1. 11.1 Store the Generated SAS Code
      2. 11.2 Control Diagnostic Messages
      3. 11.3 End When the Error Occurs
    3. Chapter 12: Complexity vs. Simplicity
      1. 12.1 Building Job Security
      2. 12.2 Ease of Use
      3. 12.3 Checking Parameters
      4. 12.4 Portability
      5. 12.5 Complexity vs. Speed
      6. 12.6 Miscellaneous Applications
    4. Chapter 13: A Final Illusion: Backtesting
      1. 13.1 The Preparation
      2. 13.2 The Steps
      3. 13.3 The Implementation
      4. 13.3.1 Programming Challenge
  7. Index