|
RATCLIFFE Technical Services Limited |
NOTE: |
|
|
Issue 17. May 2006 |
Hints, tips, and experience for SAS(r) practitioners | |
|
Subscribe and/or view our archive of back issues at NoteColon.info |
As I sat listening to the guest speaker at my daughter's school's speech day, I began to think of SAS V9. Not an obvious connection you might think. Let me explain. The guest speaker was Andrew Cooney: at the age of 23, the youngest person to reach the South Pole. Andrew's story began with many months of planning, followed by the 53 day trek from the Antarctic coast to the Pole. Truly a remarkable achievement. And the link with SAS V9? Well, I don't entirely equate the effort of installing V9 with Andrew's own efforts, but most people do acknowledge that it's not as easy as it was with V8. But, as with Andrew's project, the more effort you put in, the greater the results at the end. SAS V9 is a fantastic platform from which the benefits of the SAS system can more easily and more cost-effectively be made available to an enterprise; so there are rewards for the increased effort. NOTE: has historically focused on the syntax and semantics of the SAS language; we intend to include more articles about installation and exploitation of SAS V9 in future issues. We begin by featuring BISUG (Business Intelligence SAS Users Group). The next issue of NOTE: will look a little different. It will reflect our adoption of the RTSL name; this in turn reflects the growth in services provided by RTSL, with less emphasis on individual members of our staff. We recently acquired the new internet domain name rtsl.eu, so expect NOTE: issue #18 to come from the rtsl.eu domain (you might need to update your mail filters). The content will, of course, remain as useful and valuable as ever. -Andrew Ratcliffe |
|||
|
|
||||
|
Macro quoting - eurgh! |
When mentoring or training on macro programming, the topic we most dislike is quoting. Explaining why quoting is necessary is bad enough, but then we have to explain the differences between each of the quoting functions. There's a good explanation of each in SAS OnlineDoc, under the heading "Deciding When to Use a Macro Quoting Function and Which Function to Use". However, having made all of those explanations, we then need to broach the subject of unquoting. If you haven't come across the need to unquote yet, just follow this example... We need to write a bit of macro parameter validation code, as shown below:
%macro qwote(parm=); This code checks to be sure that PARM is either "alpha" or "beta". If you run %qwote(parm=bad) you get "ERROR: QWOTE: Invalid value for PARM (BAD)" written to the log, as expected. However, if PARM is set to "and" for example, SAS will mis-interpret our intentions and we'll get a SAS-issued message "ERROR: A character operand was found in the %EVAL function...". This is because SAS sees the %if statement as: %if and ne ALPHA and and ne BETA %then. So, you can see that SAS is interpreting the two occurrences of "and" as logical operators in the condition (in addition to the third "and" which is an intentional operator). The solution is to quote it in order to distinguish it. We can achieve this simply by adding %upcase in an appropriate place within %qwote: %let parm = %quote(%upcase(&parm)); Having added the %upcase we can run %qwote(parm=and) and get our intended ERROR message. If you would like to check to see that your macro variable values have been quoted, you can do so by using %put _user_ or any other of the special underscore keywords. Using an ordinary %put won't work because SAS will automatically remove non-printable characters. When you use %put _user_, or one of the alternatives, you will see the "macro quotes" are strange symbols in your log, or perhaps as blanks - it all depends on what OS you're using, and what tool you're using to view the log. Finally, SAS provides the %unquote macro for a reason. Although SAS software will generally unquote stuff automatically for you when required, there are a small number of circumstances when it won't - usually related to situations where you have used macro quoting to quote some ordinary quotes. For details on these situations, and macro coding in general, we recommend "A Serious Look at Macro Quoting" by Ian Whitlock (Westat) and "Secrets of Macro Quoting - How and Why" by Susan O'Connor (SAS Institute) as good reads. Have fun. |
|||
|
How Can We Help You? |
||||
|
Advertisement |
RTSL (Ratcliffe Technical Services Limited) is one of the leading SAS specialists in the UK. RTSL designs, builds, implements, and maintains SAS-based applications. With our imagination, expertise and analytical skills, we have the ability to help your company manipulate data to make informed business judgments. Providing services to the SAS community since 1993, RTSL has implemented a wide range of business solutions in a wide range of industries. See the case studies on our web site to get just a flavour of how we could help you. Contact us for further details. |
|||
|
Avoid disappointment |
In our last issue, we covered a technique for reducing and managing risk in data warehouse projects. Risks surface in all projects, large and small, and it is the responsibility of the project manager(s) to reduce and manage those risks. If risk were not part of every project we commence, we'd all dash out and start building new houses and fancy new sports cars without plans or blueprints. But it's not good enough to assume that all will be okay simply because you have got a good team of people. Often it's the simple things that cause surprises: a disk drive fails on the development server, or a key member of the new team urgently needs some personal time off. For projects in which RTSL plays an active management role, we always ask the following three questions for every task on the plan:
It all sounds simple and obvious, but it's all too easily overlooked, or put to one side. We also consider whether there are any tasks missing from the plan! Project risk management is far more complex than this, but if you consider each of these three questions, answer them honestly, and document your conclusions, you'll have made a positive step towards a more successful outcome for your project. The programming/build phase of a project is just one source of risks. Fred Brooks made the following observations in his classic and invaluable book on the human element of IT projects - The Mythical Man-Month.
If you don't already have a copy of The Mythical Man-Month, you can follow the links from our library and get a copy for yourself. |
|||
|
Tools of the Trade - Elvis Lives |
||||
|
SAS log analyser |
It would seem that Elvis is alive and well at Oceanview Consultancy. They have just made version 1.1 of their SAS log viewer and analyser available; and it's called Elvis (we couldn't find any explanation of the name). Offering somewhat similar facilities to our own Log Filter but in a different package, Elvis allows you to open a log file or paste one into Elvis's viewer. In the viewer, Elvis colour-codes lines of your choosing, allows quick searches for errors and warnings, and provides a separate pane showing the macro call hierarchy (a feature definitely not found in Log Filter). Sadly, it's only available for Windows, but if you have a strong case for migrating it to another platform, try giving Oceanview a call. In the brief period of time that we have spent with Elvis so far, we've found it to be no Heartbreak Hotel, but an excellent Hound Dog for finding errors in our logs. If you still have Suspicious Minds, give it a try for yourself (for free); if you don't like it, you can always Return to Sender. We will follow the progress of this promising tool with interest. The free trial version is limited to the first 1,200 lines of any log file. You can buy a single-user full version for £99. We think that's good value. By comparison, you could buy three Elvis Glitter Globes (@ $49.99) from the Elvis Shop. We know which purchase we'd rather make! |
|||
|
BISUG |
Are you aware of the Business Intelligence SAS Users Group (BISUG)? The main goal of BISUG is to promote the sharing of information related to SAS Business Intelligence (BI) products, including Enterprise Guide, Add-In for Microsoft Office and Web Report Studio. The web site has plenty of useful information, including a regular newsletter, BI papers, and BI training. These resources are free for members, and membership is free. |
|||
|
An excellent source of information |
While preparing the previous issue's SAS With Style article on the Principle of Least Astonishment, I referred to the Wikipedia in order to validate the article. Like so many trips to the WWW, I got side-tracked by following interesting links. And in so doing I was reminded of what a deep and wide mine of information the Wikipedia is. Wikipedia describes itself as
One of the most notable aspects of Wikipedia is that anybody can contribute to it. If you see an error on any page, or you wish to add content, you can go ahead and do so, right there on the page. Of course there's an army of volunteer editors checking behind the scenes, but it really is a community project. And there are articles on SAS System and SAS Institute. These detail the life of the software and company all the way from the founding of the company back in 1976 right the way through to the introduction of version 9. The Principle of Least Astonishment took me to Occam's Razor (via the Discussions tab), William of Ockham, the village of Ockham, and thence to the mother of computer programming Lady Ada Lovelace. Having spent time reading each of the fascinating articles, I ran out of time to compose an article for this issue; doesn't that happen all-too-often?! Until next time, enjoy Wikipedia... |
|||
|
Advertisement |
|
|||
|
|
This diary provides a guide to some of the key world-wide events that we judge to be of interest to SAS professionals. If you visit any of the listed events, please send us an email and let us know what you thought of it. |
|||
|
|
May 2006
June 2006
July 2006 October 2006 November 2006
April 2007
|
|||
|
|
You can subscribe and unsubscribe by visiting our web site at www.ratcliffe.co.uk. Or, to subscribe just click here and hit the Send button in your email client; and to unsubscribe, just click here and hit the Send button in your email client. Please do not include a message in the body of the email, it will not be seen by a human! Back issues are available from the archive at www.NoteColon.info. Please send comments to note.editor@ratcliffe.co.uk. NOTE:
(c) 2006 Ratcliffe Technical Services Limited. All
rights reserved. Republication by permission only. You may forward copies only if no fee is involved. Please encourage the recipients of the forwarded copy to subscribe and get their own free copy of NOTE:. NOTE: is a production solely of RTSL and has no affiliation with any other organisation. This edition of NOTE: was sent free to 3,693 subscribers worldwide. This is a valid HTML 4.01 Transitional document |
|||