You are previewing SAS Macro Language Magic.
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. 1.1 Keep It Simple
      2. 1.2 Keep Up with the Software
      3. 1.3 Experiment
      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
      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
      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
      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
      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
      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
      1. 9.1 Basic Rules
      2. 9.2 Truth in Numbers, Expressions, and Comparisons
      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
      1. 11.1 Store the Generated SAS Code
      2. 11.2 Control Diagnostic Messages
      3. 11.3 End When the Error Occurs
      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
      1. 13.1 The Preparation
      2. 13.2 The Steps
      3. 13.3 The Implementation
      4. 13.3.1 Programming Challenge
  5. Index