Carpenter’s Complete Guide to the SAS Macro Language


Author: Art Carpenter

Publisher: SAS Publishing

Written for the experienced SAS programmer, this book starts with a systematic introduction to the SAS macro facility. Learn to define macro variables and macros, and go on from there to use the macro facility as a way to package reusable code. The many general-purpose macros included are useful in their own right and also serve as examples of how to write your own macros for managing and analyzing data, generating reports, and working with the SAS and operating system environment.


2 Paperback (2004)

1 Paperback (1998)

The second edition is updated for SAS 9.1.

2 Paperback

Year: 2004

ISBN: 1-59047-384-1

Pages: 475

Publisher’s list price: 74.95


  • Chapter 1. Introduction
  • Chapter 2. Defining and Using Macro Variables
  • Chapter 3. Defining and Using Macros
  • Chapter 4. Macro Parameters
  • Chapter 5. Program Control through Macros
  • Chapter 6. Interfacing with Data
  • Chapter 7. Using Macro Functions
  • Chapter 8. Using Macro References with the SAS Component Language (SCL)
  • Chapter 9. Writing Dynamic Code
  • Chapter 10. Controlling Your Environment
  • Chapter 11. Working with SAS Data Sets
  • Chapter 12. Building and Using Macro Libraries
  • Chapter 13. Miscellaneous Macro Topics
  • Appendix 1. Exercise Solutions
  • Appendix 2. Utilities Locator
  • Appendix 3. Example Locator
  • Appendix 4. Macro Locator
  • Appendix 5. Example Data Sets
  • Glossary
  • Bibliography
  • Index

From the back cover

Art Carpenter thoroughly updates his successful first edition with an extensive collection of new examples and techniques. Addressing the composition and operation of the SAS macro facility, Carpenter’s Complete Guide to the SAS Macro Language, Second Edition is filled with ready-to-use macros, macro functions, and macro tools that will enable you to effortlessly convert SAS code to macros, define macro variables, and more!

1 Paperback


Year: 1998

ISBN: 1-59047-384-1

Pages: 223

Author’s comments

“This book makes no assumption about the reader’s ability to use the macro language. There are both beginner sections as well as complete utilities for the advanced macro specialist. As a matter of fact, the first two sections of the book are designed to be used as a textbook for either a self-taught or instructor-based course on SAS macros.” [Art Carpenter interviewed in Authorline, 2nd quarter 1998]