All Reported Out


I’ve spent quite a while now going through chapter 8, “Creating Enhanced List and Summary Reports,” in the Base Certification Prep Guide. This topic should be straightforward, I keep telling myself. So why did I score 40% on the quiz?

Thinking that I probably needed to delve a little deeper, I tried to complete the sample data and SAS programs associated with chapter 8 on the CD that comes with the Base Certification Guide. Although I got through the first seven topics with no problem (note to self: go through the sample data and SAS programs on the accompanying CD for all the chapters; they really help!), I got stuck on order variables, much as I did in the hard copy of the chapter itself.

Here is the sample code found on the CD:

It tells me to run the code and view the log and report. No problem! Then it says to modify the code to order rows in descending order of values of ID and then resubmit. So I do, by changing:

define id/ order;


define id/ orderdescending;

which I dutifully do, but it doesn’t seem to work. Nothing changes, and I check the log and see this:

What is up with the WARNING statement? “Assuming the symbol ORDER was misspelled as orderdescending.” I don’t understand why this wouldn’t work. So I try with it with a space between “order” and “descending,” and guess what? It works. Probably not a surprise to you, I know. At least in the version of the prep guide I’m using, it looks like no space is there. So I get clever and try to change it to “order ascending,” and I get a really scary error message. Is this because the default is ascending?

So I move on. This is awfully taxing for a Friday afternoon. Next assignment asks me to run this code and review the output:

The output looks like it did before. Which variable, it asks, is preventing PROC REPORT from collapsing observations? This was another concept I had trouble with. The solution, according to the CD, is to “remove ID from the COLUMN statement and delete the DEFINE statement for ID.” But what if I wanted ID in the columns?

The guide itself states: “The problem with the output is that your report contains display variables. As character variables, Orig and Dest are defined as display variables by default. All of the variables in a summary report must be defined as group, analysis, across, or computed variables. This is because PROC REPORT must be able to summarize all variables across an observation in order to collapse observations. If PROC REPORT can’t create groups, it displays group variables as order variables.”

Huh? So do I just remove the offending character variable from the columns included, or could I have just added “group” to precede “order” in the define statement? Clearly I am not getting this at all. Will someone explain this to me in another way so that I understand it?

This was the most challenging chapter so far, for me at least. And I haven’t even brought up the dreaded computed variables.


By the way, while you are reading blogs, surf on over to check out Renee Harper’s latest blog post, “Advice to a New SAS Programmer.” Renee saw an interesting question posted to Twitter by @sastips. She asked experienced SAS programmers what advice they would give to new or junior SAS programmers. Renee listed a few of the replies and asked for more, and many more have been added. I was heartened to see that the number-one tip was to get certified. Indeed. So please add any tips you have for us new SAS programmers in the comments section. Know that I’ll be reading!


About Author

Stacey Hamilton

Acquisitions Editor

Stacey joined SAS in 2008 as an editor for SAS Press, after a long career at a university press. She has worked in nearly every facet of the book publishing industry, from acquisitions to proofreading to manufacturing.

Related Posts


  1. Hi, I was just reviewing and don't see that chapter (“Creating Enhanced List and Summary Reports") in my SAS Cert Prep Guide (copyright 2011)!

    • Shelly Goodin

      Hi Mike,
      I have an answer for you. The Creating Enhanced List and Summary Reports chapter was removed from the third edition of the guide because PROC REPORT is no longer a focus on the base certification exam. Thank you for your patience.

  2. Stacey Hamilton on

    Hi Jody,
    Thanks so much for the feedback. I will indeed try not to be frightened when I see 22-322 errors. I can't imagine why the software gets so upset over a little incorrect syntax! I guess now I should not be surprised when authors are taken aback when I edit their writing with my red pen (or, more commonly, Word's Track Changes). Maybe I'll switch to a calming blue!
    Thanks again,

  3. Hi Stacey, I enjoy reading about your upcoming certification. I address errors every day in Technical Support so you got me curious about the really 'scary' one in your Feb. 8 post. As I understand it, you were trying “order ascending” in the DEFINE statement in PROC REPORT. I replicated this long error which sure enough amounts to a striking amount of red. I get "ERROR 22-322: Syntax error, expecting one of the following: a quoted string....and the error goes on and on to list my every available option for the DEFINE statement. As you guessed, PROC REPORT is not recognizing 'ascending' as a valid option. I know syntax errors always start with 22-322 so I overlook this error's overbearing nature. All I have to do is pick from the list to remove the error. As they say, 'we've got its number'!

  4. You've probably figured this out by now, but "order" and "descending" are two separate words. The warning message is telling you that SAS recognized "order" and thinks that there are garbage characters attached.
    PROC REPORT is not my strong point, but
    define id / order descending;
    will definitely get rid of the warning message. It may even order the rows the way you want!

Leave A Reply

Back to Top