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


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


Talk:Carpenter’s Complete Guide to the SAS® Macro Language, Second Edition by Art Carpenter

From sasCommunity
Jump to: navigation, search

Reviews and Comments

Review by Charles Patridge

{The following review by Charles Patridge was made on an early draft of the Second Edition. Some of the things that he points out were caught/changed/fixed/added before the book went to press. In any case I appreciate Charles' attention to detail and his kind words from a 'Macro Expert'. --ArtCarpenter 21:24, 11 April 2007 (EDT)}
Preview Copy
Anticipated Publication Date: February 2004
Price: $55.95
Order Number: 59224
Book reviewed by Charles Patridge – January 13, 2004

Specific Comments:

  • 1. In the beginning, it would be helpful to illustrate several of Art’s Macro examples by showing the “resolved macro values” using mlogic / symbolgen to make it clearer to the less advanced readers.

{This falls in the "Wish I had thought of that" category--AC}

  • 2. Also, Art points out in several situations why it is necessary to use double quotes versus single quotes to resolve a macro variable – it might be wise to show this as an example to illustrate the point. {A couple of examples where resolution becomes an issue can be found in Sections 10.1.5 (p250) and 10.2.2 --AC}
  • 3. In Section 12.2.1 there is a typeo in item #1 – it appears to be an OVERTYPE situation {I only wish that this was the only typo, fortunately most have been corrected by the current (fourth) printing -- AC}
  • 4. Finally, Art mentions some new macro features/system macros that we can expect in SAS Version 9 throughout his book. I recommend that all new features/system macro variables in SAS V9 should ALSO have a section of their own to highlight to experienced macro users what to watch out for and quickly review without having to search through the book. {The 2nd Ed. was written under SAS 9.0. A list of the features that Charles mentions is in the frontmatter of the book xxi-xxii. One feature that was available in SAS9.0 is no longer available. The IN operator (Section 5.2.3)may return in SAS9.2 -- AC}
  • 5. It would also be useful to have all the macros listed in an appendix of this book with references as to where they can be found as well as hyperlinks to a website to be able to download them for testing and usage. {Appendix 4 lists all the macros in the book. All the code, data sets, as well as solutions to the exercises can be downloaded from the page describing the book [1] --AC}

General Comments:

  • I only wish I had been asked to review Art’s First Edition of this book as it is an excellent reference and tutorial on the SAS Macro Language and Environment, and how it works. I STRONGLY recommend all SAS users (beginner to advance) should have a copy in their library and read it from cover to cover! This book may be more advance for the beginner but the novice SAS user should read and re-read this book as he/she starts to dabble into the SAS Macro environment and advance their knowledge of the SAS system.

Having used SAS for 25 plus years, I can honestly say I am always amazed at what I learn from reading books by users and the little things I may have overlooked or forgotten. I wish Art’s book was available 25 years ago so I could have learned the SAS Macro Language more thoroughly than I did.

Art did an excellent job writing this book with plenty of good examples and well-documented bullets and callouts of each step within his examples to explain. He has also included a number of good macros that could be used by any SAS developer and incorporate them into their library of tools.

This is a must have book for the serious SAS developer who wishes to use and learn the SAS Macro Language.


Charles Patridge
Senior Data Engineer
Full Capture Solutions, Inc.
Email: Charles_S_Patridge@prodigy.net
Web: http://www.sconsig.com


Typos and Burps

Most of the typos have been corrected in the 4th printing, therefore listing typos and such from an earlier printing will be counter productive. Here are the ones that I know about in the 4th printing:--ArtCarpenter 21:21, 11 April 2007 (EDT)

Known Typos in the Fourth Printing

p. 23
The year in the second title should be 07

p. 184
The %CURRDATE macro should use %QLEFT not %LEFT.

Reader Detected Typos

Please let me know if you find something that you think might be a typo.--ArtCarpenter 14:57, 20 April 2007 (EDT)


Things you would like to see added

Assuming there is a Third Edition, are there topics that you would like to see added or enhanced? How can I make this book more complete?--ArtCarpenter 21:21, 11 April 2007 (EDT)

Chapter 9 Control Data Sets

In Chapter 9 control data sets are discussed, but are not included in the sample code that can be downloaded with the book. The following SAS program will generate those data sets.


  * DBDIR
  * One observation for each data set in the project;
  data dbdir;
     infile datalines truncover;
     input @4 dsn $8. @15 page 2. @20 keyvar $30.;
     datalines; 
     DEMOG      1    SUBJECT
     MEDHIS     2    SUBJECT MEDHISNO SEQNO
     PHYSEXAM   3    SUBJECT VISIT REPEATN SEQNO
     VITALS     4    SUBJECT VISIT SEQNO REPEATN
     run;
  * VRDIR
  * One observation for each variable in each data set.  
  * Variables that are in all data sets within the project have ALL as the data set name; 
  data vrdir;
     infile datalines truncover;
     input @4 dsn $8. @13 var $8. @22 pg $1. @25 label $40.;
     datalines;
     ALL      SUBJECT  $  Patient number
     ALL      PTINIT   $  Patient initials
     DEMOG    DOB      $  Date of birth
     DEMOG    SEX      $  Sex
     MEDHIS   MEDHISNO 8  Medical History Number
     MEDHIS   MHDT     $  Date of medical history
     PHYSEXAM PHDT     $  Physical exam. date
     PHYSEXAM WT       $  Weight
     run;


  * FLDDIR
  * Identifies data constraints for each data entry field or variable.;
  data flddir;
     infile datalines truncover;
     input @4 dsn $8. @13 var $8. @23 chktype $8. @34 chktext $20.;
     datalines;
     DEMOG    CENTRE    notmiss
     DEMOG    RACE      list       ('1','2','3')
     MEDHIS   MHDT      format     date7.
     run;