Susan Slaughter

Archive for the ‘Little SAS Book Series’ Category

Which Little SAS Book?

In Enterprise Guide, Everything, Little SAS Book Series, Publishing, SAS on May 13, 2013 at 2:56 pm

The Little SAS Book: A Primer, Fifth EditonOne of the problems that Lora Delwiche and I face as authors of two books with similar titles (The Little SAS Book and The Little SAS Book for Enterprise Guide) and multiple editions (five of LSB and three of LSBEG) is explaining how the books are different.

The two books are totally different–and complementary.

So I was delighted to see that someone at SAS Press has written a great summary comparing the various editions.

Did you know that the title The Little SAS Book was originally a joke? We explain that and give a little history on sasCommunity.org.

The Little SAS Book Fifth Edition

In Everything, Little SAS Book Series, ODS Graphics, Publishing, SAS on November 19, 2012 at 9:28 am

Cover of The Little SAS Book: A Primer, Fifth EditonFive editions is a lot!

If you had told me, back when we wrote the first edition, that some day we would write a fifth; I would have wondered how we could possibly find that much to say.  After all…it is supposed to be The Little SAS Book, isn’t it?

But those clever folk at SAS Institute are constantly hard at work dreaming up new and better ways of analyzing and visualizing data.  And some of those ways turn out to be so fundamental that they belong even in a little book about SAS.  That’s especially true of this edition.

SAS 9.3 introduced several fundamental changes.  So we rewrote the book to reflect these.  One of the new defaults is that output is rendered as HTML instead of text.  That meant that almost every section in the book needed to be updated to show the new default output.  And since text output still has its uses, we added a section on how to send output to the good old LISTING destination.

In addition, ODS Graphics has matured a lot since it was introduced with SAS 9.2.  It has new default behaviors, and is now part of Base SAS.  The fourth edition of our book included a few sections on the SG procedures (SG stands for Statistical Graphics), but these procedures have developed so much that we felt they now deserved their own chapter.

In addition, here and there we split sections in two or added new ones to expand on features that were only mentioned before.

Here’s a short list, in no particular order, of new or expanded topics in the fifth edition:

  • Linguistic sorting
  • Concatenating macro variables with other text
  • AGE argument for the YRDIF function for computing accurate ages
  • LISTING destination for text output
  • PROC TTEST
  • PROC SGPANEL
  • Graph legends and insets
  • Graph attributes such as lines and markers
  • Image properties such as DPI
  • Saving graphics output
  • Many new graph options such as NBINS= for bar charts

Along the way, we removed topics or sections that had begun to feel dated or out of place.  For example, we took out the appendix on Coming to SAS from SPSS because it is now available as a free download that is both better and more complete.

So even though we have added a lot to this edition, it is still a little book.  In fact, this edition is shorter than the last—by one whole page!

To order a copy of this book, or view the table of contents or a sample of the book, visit the SAS Press web site.

The Reviewer Is Always Right

In Everything, Little SAS Book Series, Publishing, SAS on June 1, 2011 at 1:13 pm

…about something

…and it’s up to you to figure out what.

At SGF I had the honor of participating in a panel discussion titled “So You Want to Be a SAS Press Author!”  The panel was organized by Nancy Brucken, moderated by Michael Raithel and included authors Art Carpenter, Cynthia Zender, and Mike Molter.

During the discussion, the topic of reviewer comments came up.  I mentioned that when Lora Delwiche and I first sent our proposal for The Little SAS Book to SAS Institute, one of the reviewers said, “It’s not possible to write a book like this, and if you do, then you will be doing a disservice to readers!”  That was a pretty strong statement, and it stung—a lot.  I mentioned this to make the point that you can’t let negative comments derail you from following your dreams.  However, I now realize that I may have left people with the impression that they can safely ignore any comments they don’t like.  On the contrary, I have learned the hard way that

There is something to be learned from every reviewer’s comment.

Those comments you don’t like…they’re the ones you should pay the most attention to.  Maybe, just maybe, that reviewer knows something that you don’t.  And maybe, just maybe, that reviewer is even right.  If that is the case, wouldn’t you rather find out before your book goes to press?  Yessiree, that reviewer might be doing you a favor.  Maybe you should (politely!) ask that reviewer for more information.  At times like this, it is important to set aside all defensiveness and listen because there is something to be learned from every reviewer’s comment—although it is not always what the reviewer intended.

For example, you will likely get some comments that are just factually incorrect.  When you do, it’s tempting to think, This reviewer doesn’t understand!, and then ignore the comment.  However, when you get such comments, you should ask yourself, Why doesn’t this reviewer understand?  If the reviewer didn’t understand, then perhaps readers won’t understand.  Can you make your writing more clear?  Did you fail to explain something?  What does this reviewer need to know in order to understand?

So what was the lesson to be learned from the reviewer who said that it was impossible to write The Little SAS Book, and that if we did, we would be doing a disservice to readers?  The lesson I learned is that some people will react very negatively to a book that is small and friendly.  Of course, Lora Delwiche and I never imagined that we were writing a book that would appeal to everyone and that would meet every SAS programmer’s needs.  But we also never imagined that some people would react so violently.  Honestly, I do think that some people need to get a life.  It’s just a book, for goodness sake.  But even so, this reviewer did us a favor by warning us.

Susan’s Macro Mottos

In Everything, Little SAS Book Series, SAS, SAS Global Forum, SAS Papers on February 10, 2011 at 2:56 pm

With SAS Global Forum less than two months away, I am busy putting the finishing touches on my papers.  One of those papers is SAS Macro Programming for Beginners. Of all the conference papers I have written over the years, this is probably my favorite.  Yet oddly, I have only presented this paper once at SGF and that was long ago.  So I am pleased to have an opportunity to dust this paper off.

Don’t expect a lot of advanced macro tricks here.  This paper is exactly what the title says: macro programming for beginners.  It’s a crystal-clear presentation of the basic concepts you need to understand in order to be comfortable in the company of SAS macros.  I can summarize the paper in two sentences that I call “Susan’s macro mottos.”  Here they are:

Susan’s Macro Mottos

Remember: You are writing a program that writes a program.

This is the most important concept to keep in mind whenever you write or debug SAS macros.  If you feel the least bit confused by a macro, repeating this motto can help you to see what is going on.  I speak from personal experience here. This is my macro mantra.

To avoid mangling your macros, always write them one piece at a time.

First write your program in standard SAS code. When that is working and bug-free, then add your %MACRO and %MEND statements. When they are working, then add your parameters, if any, one at a time.  If you make sure that each macro feature you add is working before you add another one, then debugging will be vastly simplified.

If you are lucky enough to attend SAS Global Forum and you want to catch this presentation, look for me in the Milano V-VI room Tuesday April 5, 2011, 10:30-11:20 am.

Click here to download the paper.

SAS Data Step Illustrated: Guest Blog by Jiangtang Hu

In Everything, Guest Blog, Little SAS Book Series, SAS on January 4, 2011 at 11:07 am

The following blog is reprinted by permission of the author Jiangtang Hu. Hu is a SAS programmer living in Beijing who writes blogs in both English and Chinese. (Full disclosure: Hu quoted The Little SAS Book, but I had never met him before he wrote this blog.)

SAS Data Step’s Built-in Loop: An Illustrated Example

Some newbie SAS programmers take SAS as their first programming language ever learned. Sometimes they are confused by the concept of “data step’s built-in loop” even after reading the well-written The Little SAS Book: A Primer:

DATA steps also have an underlying structure, an implicit, built-in loop. You don’t tell SAS to execute this loop: SAS does it automatically. Memorize this:

DATA steps execute line by line and observation by observation.

Programmers could memorize the statement above and apply it well in their programming practices, but still find it hard to get the vivid idea about the so called implicit built-in loop. This post would make it easy.

The following will show an explicit loop example in C++. Note that you do not need to know anything about C++ to get the idea. Suppose that a data file data.dat in D drive holds three numbers

1
2
3

The question is how to (read and) print out these numbers and their sums. Following is the C++ approach (just read the bold section):

#include <iostream>
#include <fstream>
using namespace std;
int main()
{

int x;
int sum=0;
ifstream inFile;
inFile.open(“d:data.dat”);
inFile >> x;

while (!inFile.eof( ))
{
cout<<x<<endl;
sum = sum +x;
inFile >> x;
}

inFile.close( );
cout << “Sum = ” << sum << endl;
return 0;

}

There is an explicit loop in these C++ codes: while (!inFile.eof( )) . While it is not at the end of infile, the codes above will keep print out the numbers and do the accumulation. The final output is

1
2
3
sum=6

The following SAS codes produce the exactly same output:

data _null_;

infile “d:\data.dat” end=eof;
input x;
sum+x;
put x;
if eof then put sum=;

run;

Note that SAS codes do not need an explicit loop to reach to the end of file. There is a so called implicit built-in loop.

Save 30% on All SAS Publishing Titles

In Enterprise Guide, Everything, Little SAS Book Series, SAS on December 8, 2010 at 11:56 am

Still looking for that perfect holiday gift?  For a limited time you can save 30% on all books from SAS Publishing. Most of these books are a little big for stocking stuffers, but they fit just fine under a tree.  This offer expires Dec. 13, 2010 so don’t delay. Click here for details.

What can I use SAS for?

In Everything, Little SAS Book Series, SAS on December 1, 2010 at 11:37 am

According to my site stats someone found this site yesterday by searching for the phrase “what can i use sas for?’

I’m flattered. And I hope they found the answer to their question. Though to be honest, I doubt that anything I have previously written addressed the use of SAS in such broad terms. So let me try to rectify that now.

What can I use SAS for?

Wow, that is a big question!  Most SAS users would probably agree that it would be easier to say what you can’t do with SAS than what you can.

I know, if you are not a SAS user, then you’re probably thinking that that is an incredibly arrogant statement, but please keep reading and then you can judge for yourself.

Here are some things you probably wouldn’t use SAS for:

You probably wouldn’t use SAS to program a robot—unless that robot used a statistical algorithm for it’s guidance.

You probably wouldn’t use SAS to write a cookbook—although I have personally used it to write the indexes for all my books.

You probably wouldn’t use SAS to design a building—unless you were conducting ergonomic research to improve your design.

You get the idea…SAS is a general purpose tool that—with a little imagination—could be applied to almost anything.

SAS is a work horse that is used to crunch through gigantic data bases, the kind that the Census Dept. and credit bureaus have.  But it’s also nimble enough to be used by students in introductory statistics courses.

In short, SAS is a suite of software products for data management, statistical analysis, data visualization and reporting.

True stories:

Anyone who has ever browsed through a copy of The Little SAS Book knows that it is packed with examples.  Some of these examples use real data, but others use data that is purely imaginary.  One of our more outlandish examples concerns the fictitious Fun Times Amusement Park.  I have always considered this to be one of our less believable examples.  However, a couple years ago at SAS Global Forum someone who worked for a major amusement park presented a paper analyzing data not unlike ours.  I thought, “Wait a minute. That can’t be real! We made that up!!!”

Another of our more silly data sets concerns minor league baseball teams with names like the Gilroy Garlics and the Sacramento Tomatoes.  The data didn’t seem terribly believable to me…until we got a question from a reader who was analyzing data for a a very real rugby team.  Here is the bar chart to prove it.

They say that “Life imitates fiction.”  Apparently, it also imitates computer manuals.

Long ago someone on SAS-L asked the question “What does SAS do best?” I remember thinking “SAS does everything the best.” By that I do not mean to say that SAS does every single thing better than any other software package.  What I mean is that if you want a software package that does everything—or at least as close to everything as is computationally possible—then SAS is the best.

Does that mean that SAS is perfect? No.  A friend who is a statistician complains  to me that SAS is not very good for bootstrapping. And the dot plots that SAS produces bear no resemblance to dot plots in statistics text books that I keep running into.  And there is no easy way to get your results from SAS into PowerPoint (although I hear that they working on this last item).

Despite these imperfections, if you have a problem that has something to do with data, then SAS can most likely help solve that problem.

Probably the biggest problem faced by the sales people at SAS Institute is convincing a skeptical world that SAS does indeed do all that it does.

© Susan Slaughter.

Copyrights and Apple Pie

In Everything, Little SAS Book Series, Publishing, SAS on November 15, 2010 at 1:28 pm

Like all writers (and artists, musicians, software developers, and other creators of content) I am concerned about the problem of copyright infringement. (Here is my previous post about this.)  So I was interested to find out that while I was at the Western Users of SAS Software conference, there was a veritable brouhaha about this issue.

In case you missed it, here is what happened:  A blogger named Monica Gaudio discovered that a post she had written about the history of apple pie had been published by a for-profit magazine named Cooks Source.  (Here is the original blog.)  Cooks Source gave Gaudio credit but didn’t pay her a cent or even inform her that they had used her work.  Gaudio asked Cooks Source to apologize and make a $130 donation to the Columbia School of Journalism.  Cooks Source refused to apologize or make the donation, and even suggested that Gaudio should pay them for editing her work.  When people heard about this, they began to wonder about the source of Cooks Source’s other content.  Using the Web, they quickly found that Cooks Source had lifted articles from Martha Stewart, the Food Network, Weight Watchers, and even NPR.  (Here is the story on NPR.)

Cooks Source claimed that anything on the Web is public domain and therefore free for them to use without compensating (or even crediting) the creators of that work.  This is simply not true.  Virtually nothing written in the last 20 years is public domain.  (Here is an interview with a legal expert on NPR.)

Cook’s Source has now apologized. (Here is their web site.)  However, they have also changed their story and now claim that publishing Gaudio’s article was an “oversight.”   Illogically, they also claim that they are the real victims here.

I, for one, am just happy to see the attention this issue has generated.

Note: The image in this blog was used by permission of the USDA Agricultural Research Service.

WUSS and My 7 Minutes and 39 Seconds of Fame

In Enterprise Guide, Everything, Little SAS Book Series, SAS, Western Users of SAS Software on November 10, 2010 at 8:53 am

I have just returned from another great Western Users of SAS Software conference.  Normally at this point I would write a summary of the conference, but this year I don’t have to.   Instead, you can hear my summary in this interview by Sy Truong of Meta-Xceed, Inc.

To hear all of Sy’s interviews at the conference, click here.

Does Crime Pay?

In Everything, Little SAS Book Series, Publishing, SAS on August 18, 2010 at 9:25 am

Answer:  It certainly doesn’t pay authors.

My sister recently told me that the Sacramento public library lists one copy of The Little SAS Book in their catalog.  However, it turns out that someone has stolen that one copy.

I figure that’s a compliment of sorts: Someone wanted The Little SAS Book enough to steal it.  To tell the truth I was flattered that the Sacramento public library had a copy of The Little SAS Book at all.  Next time I’m in downtown Sacramento, I must remember to donate a new copy of The Little SAS Book to the library, and while I’m at it, I might as well throw in a copy of The Little SAS Book for Enterprise Guide.

The case of someone stealing a single copy of a book from a public library isn’t a major crime.  A greater concern—at least to authors—is the evidence that electronic copies are being freely pirated.  Recently, I ran into a friend who is a student.  Looking at her laptop computer, I saw that she was displaying The Little SAS Book.  It was a sharp-looking PDF version.  Even I don’t have a PDF copy of The Little SAS Book!  “Wow,” I said, “Where did you get that?”  She sheepishly admitted that it had been given to her by another student.  She had neglected to mention this to me because she knew it was an illegal copy, and that I hadn’t been paid a cent for it.  Of course, this particular friend has a legal copy (that I gave her), so I’m not bothered by the fact that she now has a second copy even if it is illegal.

What does concern me is the fact that royalties for The Little SAS Book series have been declining, and are down 40% compared to three years ago.  During those years we worked hard and published two new editions.  So, logically our royalties should be going up, not down.  I can’t help wondering if the sales have dropped at least partly because people are using pirated copies instead of legal ones.  I’m grateful for the good sales we have had in the past, and I wouldn’t mind people passing around pirated copies if our royalties held steady.  But the truth is: I have to pay my bills just like everyone else.  The problem of piracy is not unique to me, nor to SAS Press, nor even to books.  This is a bigger problem that applies to music and movies too, and you can bet I’ll be watching to see how it turns out.

Follow

Get every new post delivered to your Inbox.