As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Carpenter’s Complete Guide to the SAS® Macro Language, Third Edition by Art Carpenter

From sasCommunity
Jump to: navigation, search

For SAS programmers or analysts who need to generalize their programs or improve programming efficiency, Art Carpenter thoroughly updates his highly successful second edition of Carpenter's Complete Guide to the SAS Macro Language with an extensive collection of new macro language techniques and examples.

Addressing the composition and operation of the SAS macro facility and the SAS macro language, this third edition offers nearly 400 ready-to-use macros, macro functions, and macro tools that enable you to convert SAS code to macros, define macro variables, and more! Users with a basic understanding of Base SAS who are new to the SAS macro language will find more detail, utilities, and references to additional learning opportunities; advanced macro language programmers who need help with data-driven macros and dynamic application development will find greatly expanded treatment of these topics.

Sample Code and Data:
Download the sample code and data here or link to it directly at Art's SAS Press author page.

There are several hundred references to other books and papers on the macro language cited in the book. The Reference section including active links has been uploaded. View the PDF of the References here.

Reviews of this book can be found here. Please feel free to add your own review.

This revised and enlarged edition includes the following topics:

  • New and expanded introduction to the macro language
  • Functions, automatic macro variables, and macro statements new to the macro language
  • Expanded macro language tools that interface with the operating system
  • Expanded data-driven methodologies used to build dynamic applications
  • Expanded discussion of list processing, with four alternative approaches presented
  • Additional file and data management examples
  • Expanded discussion of CALL EXECUTE and DOSUBL
  • New discussion of using the macro language on remote servers
  • Expanded discussion and examples of macro quoting

Far beyond a reference manual issued from an "ivory tower," this book is pragmatic and example-driven: Yes, you will find syntax examples; yes, the code is explained. But the focus of this book is on actual code used to solve real-world business problems. In fact, an entire appendix is dedicated to listing the nearly 70 classes of problems that are solved by programs covered in this edition. Discussion of the examples elucidates the pros and cons of the particular solution and often suggests alternative approaches. Therefore, this book provides you both a compendium of reusable and adaptable code, and opportunities for deepening your understanding and growing as a SAS programmer.

This book is designed to both introduce the SAS System Macro Language and to provide a reference tool for experienced macro programmers. Because of the complexity of the macro language, this book is intended for SAS programmers with a good general grounding in base SAS software. Regardless of how you are planning to use this book, in order to get the maximum benefit, you should be well versed in the use of the DATA step and fairly comfortable in the use of basic procedures.

The macro language has a number of similarities to the language that is used in SAS DATA steps. In order to maximize the usefulness of the examples in this book, you need to be able to build on these similarities. Students unfamiliar with the DATA step should first take a basic programming course in SAS such as SAS® Fundamentals: A Programming Approach (offered by SAS Institute Inc.) or an equivalent course.

It is the intent of this book to provide the reader with both a guide and a reference to the SAS macro language. Through its use, the reader will be able to write SAS macros, convert SAS code to macros, and use macros to generalize SAS programs to maximize their usefulness. The book assists the reader so that he or she will:

  • understand the general make up and operation of the macro facility and the macro language
  • know the syntax that is used in the macro language
  • be able to define macro variables and pass macro parameters
  • understand and be able to utilize the different macro referencing environments or scopes
  • know about the phases of execution when macro statements are present
  • be able to develop and call SAS macros
  • know how to reference SAS macro functions and automatic macro variables
  • be able to use macro statements within SAS macros.

See the discussion tab for a review of this book, or to make comments and report typos.

Order this book