Susan Slaughter

Archive for June, 2010|Monthly archive page

YRDIF and Me: A Tale of Woe

In Everything, Little SAS Book Series, SAS, SAS Papers on June 29, 2010 at 12:37 pm


Since I originally wrote this blog post, a new option has been added for the YRDIF function.  The AGE option is not the easy-to-use option that I dreamed of.  However, it does compute accurate ages and that is a huge improvement!  I am now happy to recommend this method for computing current age in integer years:

CurrentAge = INT( YRDIF(BirthDate, TODAY(), ‘AGE’));

However, you should be aware that there are still situations where an alternate method may be better than YRDIF.  You should define exactly what your requirements are, and test different methods (such as INTCK) to see which method best meets your needs.

The original blog post:

In all the long history of The Little SAS Book: A Primer (four editions, five if you count the Revised Second Edition) we have removed only three topics from the book.   We dropped PROC COPY and PROC PLOT (that’s PLOT, not GPLOT or SGPLOT) because they had become largely obsolete.  Now we have removed the YRDIF function, but this situation is different. For the first time ever, we have removed a topic because it doesn’t work.

The YRDIF function has been removed from The Little SAS Book: A Primer, Fourth Edition, starting with the third printing, because it does not compute accurate ages. (YRDIF never appeared in earlier editions.)  In defense of YRDIF I have to point out that it does work the way it was designed to work; but YRDIF, it turns out, was never designed to compute ages.  Specifically, ages computed using the YRDIF function may be incorrect if the starting or ending date falls in a leap year, and the ending date is the person’s birthday. Of course, this situation doesn’t happen all that oftenbut it does happen. So, if you need really accurate ages, then you can’t use YRDIF.

We considered substituting some other method for computing ages (such as INTCK), but it turns out that not only are those methods too complicated to squeeze into the tiny space we had, they also come with their own limitations and problems.  We were forced to conclude that currently there is no single definitive method for computing ages in SAS.  If you need to compute ages in SAS, the best you can do is to choose the one that has the fewest problems for your particular situation.  After much debate, Lora Delwiche and I felt that we had no choice but to simply remove YRDIF from our book.

As a result of all this, we have written a paper, “Computing Ages in SAS: The Removal of the YRDIF Function from The Little SAS Book: A Primer, Fourth Edition.”  This paper explains how YRDIF really works, and then discusses alternate methods for computing ages. You can download this paper by clicking here.

Save 25% on The Little SAS Book Series through June 30, 2010

In Enterprise Guide, Everything, Little SAS Book Series, Publishing, SAS on June 22, 2010 at 7:05 am

The Little SAS Book series is on sale 25% off through June 30, 2010.
To order online:
1) Go to
2) Add books to cart and proceed to the checkout.
3) On the checkout page type the following in the comment field at the bottom. “LSBSeries25”
4) Final pricing, including taxes, shipping, promotional discounts will be reflected in your confirmation e-mail.

Here is what reviewers say about these books:

The Little SAS Book for Enterprise Guide 4.2

“It may be a ‘Little Book,’ but I was amazed at how much information about SAS Enterprise Guide 4.2 is included. The tutorials successfully take the reader on a journey covering all the main topics; then the reference section expands on these topics. I’ve been using SAS Enterprise Guide since version 1.1, but while reading this book I was reminded frequently of features that I ought to use more. It has something for everyone!”
Review by Philip R. Holland, Consultant and Author, Holland Numerics Ltd.

The Little SAS Book: A Primer, Fourth Edition

“The Fourth Edition of The Little SAS Book is not only an excellent primer for new SAS users, but it is also a great reference and update for experienced SAS users. The content provides a comprehensive overview of the SAS System in general, and data integration, manipulation, analysis, and reporting within SAS.”
Review by Systems Seminar Consultants, a SAS training and consulting company based in Madison, WI. Click here to read the complete review.

The Truth About What Motivates Us

In Detritus, Everything, Sacramento Valley SAS Users Group, SAS, SAS Global Forum, Western Users of SAS Software on June 2, 2010 at 8:40 am

What motivates you? When I was a kid, I used to play a board game called Careers.  In this game players moved around the board collecting points in three areas: fame , $ fortune, and happiness. The first player to achieve his chosen combination of points won the game.  It was a fun game, but I used to scratch my head at the idea that success in life could be reduced to a linear formula consisting of fame, fortune, and happiness.  (Yes, even as a ten-year-old, this seemed to me a pretty vacant idea of what life was about.)

When I was in graduate school, I heard about research showing that money can have a seemingly paradoxical effect on people.  Paying people lots of money can actually reduce their motivation rather than increase it.  What I didn’t know is that research on this topic has been ongoing.  Then my son (Elliott Slaughter, Computer Sci. and Eng. major at UCSD and open source developer) sent me the link to a fascinating talk by writer Dan Pink.  His talk is cleverly illustrated by RSA Animate.

So what does this have to do with SAS? Have you ever thought how amazing it is that we have local, regional, and international SAS user group meetings organized and executed primarily by volunteers?  Why are so many people willing to work hundreds of hours without being paid a cent year after year after year?  Pink explains why money is such a poor motivator, and what people really want.  He uses open source software as his example, but you could easily substitute SAS users groups.

Take 10 min. to watch Pink’s video Drive: The Surprising Truth About What Motivates Us.  I think you’ll be glad you did.