Chris Hemedinger

12月 242010
A customer phoned up SAS Technical Support the other day with a problem. (Yes, that happens occasionally...) When he ran a certain program through SAS Enterprise Guide, the program didn't seem to complete and no results were returned. Here is a snippet of the program (modified a bit to make it less proprietary) :
  1. proc sql noprint;
  2.   connect to teradata as tera2
  3.   (user=&user pw=&password server=&server
  4.   mode=teradata FASTEXPORT=YES);
  5.   create table buyers as
  6.     select * from connection to tera2
  7.      (select id,
  8.         trxn_dt,
  9.         sum (ln_itm_qty) as Items,
  10.         sum (ext_prc_amt as Sales
  11.         from store.linetrxn a
  12.           join cust.indv_xref b
  13.           on a.rid = b.rid
  14. /* remainder removed for brevity */
Can you spot the problem? Other than the use of a user ID and password, which can be avoided, what else is wrong with this program? Why does it fail to finish?

The SAS code formatter in SAS Enterprise Guide 4.3 can tell you. Click Ctrl+I, and the code formatter scans your program and attempts to indent it for proper readability. But for this program, it stops short of that with this message:

Formatting Error
Please check for an unmatched parenthesis on line 7.

Now you know: there is an unmatched parenthesis! And every SAS programmer knows that a missing parenthesis, unmatched quote, or missing semicolon can cause problems for the SAS language parser. (Rick Wicklin calls this a "parse-time error" in his post about finding and fixing programming errors.)

But where is the unmatched paren in this program? The message says "line 7", but line 7 looks okay. There is an open paren for the inner SELECT clause. But starting there, there must be a missing matching parenthesis within the clause. To find it, use the arrow keys in the program editor to navigate the program and visit every parenthesis character in the region. The program editor in SAS Enterprise Guide 4.3 highlights the matching parentheses pairs as you navigate:

See the matches

You can also use the Ctrl+[ (open bracket) key to move the cursor from one parenthesis to its match, if there is one. If no match can be found, the program editor emits a friendly beep to tell you, "sorry, can't find a match".

In this example, you don't have to look further than line 10, where the programmer has left off a closing parenthesis. The line should read: sum (ext_prc_amt) as Sales.

People are really starting to appeciate the new SAS program editor (including the formatter). Earlier this week I received an unsolicited phone call from a SAS programmer (who happens to work at SAS). She was calling just to say that this feature is "AWESOME" and that it has saved her countless hours as she maintains legacy SAS programs. Angela Hall also highlights it in her blog about real-world BI experiences.

I love to hear these stories. Have you started using SAS Enterprise Guide 4.3 yet? What do you like about it? And what could be improved? Let us know, either here in the comments or via SAS Technical Support.

12月 182010
You might be too young to remember Clara Peller. She was the star of a series of fast-food burger commercials in the 1980s, in which she demanded meatier meals by shouting "Where's the beef?" at the pickup counter or drive-through window. Alas, the competitor restaurant meals were afflicted with "Fluffy bun", meaning that it was difficult to find the all-beef patty because it was dwarfed by the bread in which it was served.

SAS Enterprise Guide can also serve up some meaty content in the SAS log when you run a SAS program. But in order get that content to you from your SAS session, SAS Enterprise Guide wraps your program in what we call the "ODS sandwich" -- SAS statements that open and close one or more ODS destinations around your program, so that your results can be packaged from SAS and delivered into your project view.

Sometimes, the ODS sandwich can obscure the content that you're really interested in. Consider this log:

1   ;*';*";*/;quit;run;
NOTE: Procedures may not support all options or statements for all devices. For details, see the documentation for each procedure.
12    ODS tagsets.sasreport12(ID=EGSR) FILE=EGSR STYLE=Analysis
12  ! STYLESHEET=(URL="file:///C:/Projects/f2ec43/winclient/Build/Debug/Styles/Analysis.css") NOGTITLE NOGFOOTNOTE
12  ! GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");
15   proc means;
16     class origin;
17   run;

NOTE: There were 428 observations read from the data set SASHELP.CARS.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.16 seconds
      cpu time            0.04 seconds
25   ;*';*";*/;quit;run;
29   QUIT; RUN;

There are only a few lines of interest here, but lots of fluff. It's necessary fluff, mind you. Just like you wouldn't want the fast-food restaurant to hand over your burger (and all the fixins) without a bun, you need to use ODS to deliver your output. But it's not what you came for.

In SAS Enterprise Guide 4.2 and 4.3, you can change an option to hide the fluff in your log. Select Tools->Options and go to the "Results General" page. See the checkbox option that says "Show generated wrapper code in SAS log"? If you clear that checkbox, the ODS sandwich will be hidden from you when you run your programs. (If you're curious how this works, this is the technique that we use.)

Here's the previous example with this option cleared, sans the fluffy ODS bun:

1    ;*';*";*/;quit;run;
3    %_eg_hidenotesandsource;
19   proc means;
20     class origin;
21   run;

NOTE: There were 428 observations read from the data set SASHELP.CARS.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.04 seconds
      cpu time            0.06 seconds
23   %_eg_hidenotesandsource;
37   QUIT; RUN;

Look carefully at the log. You'll notice that the line numbers are not consecutive -- it skips a few! That's because the ODS statements are still submitted and processed, but the log output for those statements is suppressed. The result is a cleaner log, with more meat than fluff.

We know that many programmers work in regulated industries, and aren't permitted to suppress portions of the SAS log like this. That's why the option is set to "show all" by default. But if you're in search of "just the beef", give this handy option a try.

12月 112010
I helped to write a quiz for the Computer Science Education Week promotions that were featured on our company intranet. Do you fancy yourself as a Comp-Sci aficionado? Let's see how you do with these.

1. Which achievement is Charles Babbage most famous for?

  1. Establishing software retail shops in shopping malls across America
  2. Inventing a strategic card game that involves using pegs to keep score
  3. As one of the "fathers" of the programmable computer
  4. Earning an all-time high score while playing Mafia Wars

2. Early computer programs and data were originally recorded on what storage device?

  1. Iomega "Zip" drives
  2. 8" floppy disks
  3. Punched cards
  4. 8-track cassette tapes

3. Which of the following is NOT a computer programming language?

  1. Lisp
  2. Python
  3. Ruby
  4. Simba
  5. SAS

4. Within a computer program, a function that can invoke itself again as part of doing its work is known as:

  1. recalcitrant
  2. recursive
  3. redundant
  4. repulsive
  5. a stack overflow exception

5. In a computer program, a variable that simply holds the memory address of another variable or data structure is called:

  1. a memory leak
  2. a pointer variable
  3. a linked list
  4. an address box


1: (c). Charles Babbage is known as a pioneer in the concept of a programmable computer, even though he lived long before the technology to build modern computers was invented. Source: Wikipedia (

2: (c). Punched cards have been around since the earliest "computing machines". Beginning in the 1960s, magnetic tape and other storage devices began to replace punched cards for data storage. Source: Wikipedia (

3: (d). At the time of this writing, there is no computer programming language named "Simba"…but it's probably just a matter of time. The most popular active programming languages are tracked at the TIOBE Programming Community Index ( The SAS programming language is currently at number 18 on the index.

4: (b): "Recursive" is the most correct answer here, but unless used with extreme care, any of the other answers might be the result.

5: (b): A pointer variable (or pointer, for short). Pointers are common in some programming languages, such as C and C++, where they are usually essential for memory-efficient operations. Those who work with higher-level languages such as Java, C#, or even SAS don't encounter pointers nearly as often (the lucky stiffs).

12月 082010
I connect to more SAS server environments than your average SAS user. In a given week, I probably run SAS Enterprise Guide connecting to at least five different Windows-based servers, a few Unix-based servers, and maybe even a z/OS machine as well.

With that many SAS environments, I'm bound to encounter one or two with a SETINIT that's in its "warning" mode: you know, when the initialization log tells you that your SAS products will expire soon and you need to renew your SETINIT (via a SAS Installation Data, or SID, file). (Yes, even inside the walls of SAS, we use SETINITs to keep our software installations working.)

Sometimes I connect too late, and the license has already expired. If that happens, you don't get a nice message from SAS Enterprise Guide that tells you why you can't connect. The message is simply, "Failed to start the SAS server." Without a current SETINIT, a SAS workspace won't start at all, and so we can't get more detailed information than that.

NOTE: This is different from the expiration date sometimes encountered in older SAS Enterprise Guide clients, which has nothing to do with SETINITs.

So for my own selfish purposes, I added a new warning message into SAS Enterprise Guide 4.3. You'll see it whenever you connect to a SAS server that has entered its "warning" stage. I encountered it today (and thanked myself for adding it!); here's what it looks like:

SETINIT Warning via SAS Enterprise Guide

What should you do when you see this warning? You should share the news, of course, and annoy your SAS administrator to apply a newer SETINIT. (In my case though, that's often me.)

I hope that this small touch serves you well, and gives you plenty of warning the next time your SAS licenses are coming close to term.

3月 232009
Humor writer and Pulitzer-Prize-winning columnist Dave Barry inspired SAS Global Forum attendees during his keynote presentation at the Technical Session.

Dave Barry introduced his topic: “High-speed access to DBMS data using SAS 9.1.3 Data Engines”

No, that wasn’t it. He just plucked that from the schedule.

Then he started with an honest statement: he had never heard of the SAS Global Forum. So he went to the Internet to do some research. And do you know what he found? He found “that there is a lot of pornography on the Internet.”

When Dave was sitting backstage listening to the technical demos, he was really intimidated that the audience probably understood all of these technical terms that were being used. He gleaned from the presentations one really good word that, if you are in business today, you should use whenever possible. That word is “algorithm”.

If your boss asks you to do something, and you aren’t sure how to do it, just say something like “well, we’d have to build an algorithm for that.” It works against managers like garlic works against vampires.

Dave admits, “I’m not a computer expert. But I do use a computer. I have a computer that informs me, regularly, that I have unused items on my desktop.” Not quite sure what to do about that.

Dave spent some time talking about where he lives: Miami. “I moved there in 1986, from the United States,” he said. He found the driving habits of Miami residents difficult to get used to, until he began to understand, “in Miami, everyone is driving according to the law -- of his/her country of origin.”

Dave related the story of a 73-year-old man who drove his Chevy Cobalt onto runway 9 of the Miami-Dade airport. “I can’t even get near that place with shampoo. But this guy got in with a Chevy Cobalt. Maybe he had it in one of those see-through zippy bags that makes everything alright.”

Dave also recounted the story of a 75-lb bale of cocaine that was thrown from an airplane and almost hit the chief of police in Miami. That sort of thing doesn’t happen in Milwaukee. Miami’s department of tourism slogan: “Come back to Miami, we weren’t shooting at you.”

As a humor writer, Dave described his job like so: ”I sit around, in my underwear, and make things up. Sort of like a consultant. [boost of applause from the audience] Except that a consultant would be wearing your underwear.”

He relayed a few embarrassing stories about himself, including one about an impromptu (and perhaps unwelcome) conversation with First Lady Barbara Bush, and his use of the Oscar Meyer Weinermobile to pick up his son from middle school. Experiences like these have informed his scientific opinion of what causes spontaneous human combustion. “Sometimes, that’s your only option.”

On getting older and medical exams: “We need a way for the doctor to get to the prostate gland other than the way they do that now.” Dave recently experienced his first colonoscopy, but it wasn’t as bad as he feared. However, the preparation was less than pleasant. “The doctor prescribes a nuclear laxative. It’s so explosive that your bowels travel into the future, and you expel food that you haven’t even eaten yet.”

Has Dave Barry ever written a column that he later regretted? Yes, there was that one making fun of North Dakota’s (yes, the state) effort to boost tourism, for which they considered many ideas, including perhaps removing the word “North” from the state name so as to appear, oh, less cold. He received many angry letters from North Dakota citizens, which culminated in Dave Barry being invited to North Dakota, during January, to commemorate them naming a public facility after him. The “Dave Barry Lifting Station 6” – a sewage lifting station.

Dave, like everyone else at the conference, had something to say on the economy. Obviously it’s in horrible shape, but Dave says not to worry. Congress has a plan to spend hundreds of billions of dollars with no idea as to who’s getting it. “I don’t see how that can fail, do you?”, he asked.

On to the inspirational story… One of Dave Barry’s favorite columns was about a group of guys who had to overcome an obstacle, and they were very innovative about it. He’s speaking, of course, about the Oregon State Highway Division and their effort to clear an Oregon beach of a large whale carcass -- using dynamite. I won’t relay the story here, but there is a web site dedicated to the event and others like it.

Dave closed with an excerpt from his book Dave Barry’s Complete Guide to Guys. The story illustrates how different the thought processes are between men and women – mainly, that women think a lot, and men, as difficult as it is for women to believe, actually think very little. His advice to women: “Lower your standards.” (Honey, are you reading this?)

[Want more? Go "behind the scenes" with Chris' interview with Dave Barry on The SAS Dummy blog.]