RTSL.eu

www.NoteColon.info

NOTE:

Issue 18. October 2006

Hints, tips, and experience for SAS(r) users

 Subscribe and/or view our archive of back issues at NoteColon.info


In this issue:

NOTE: is all about sharing knowledge and experience with fellow SAS practitioners, so I'd have no hesitation in recommending the unofficial SAS weblog to you. Whether you would have just dipped-in from time to time, or whether you subscribed via an RSS reader, you'd have found the mixture of technical and business news to be useful, I'm sure. However, I talk in the past tense because, since finding it over the summer of this year, it has sadly been closed down, so it is now merely a useful archive of SAS information. Shame!

I hope you enjoy the contents of this issue of NOTE: equally as much, and I assure you we have no intention of shutting-up shop.

As I mentioned in the last issue, we're changing our domain name from ratcliffe.co.uk to rtsl.eu. NOTE: will continue to offer you the best in SAS experience and knowledge, but you may need to update your anti-spam lists, etc.

-Andrew Ratcliffe
note.editor@rtsl.eu


 

Technical Event for SAS Practitioners (in London)

Don't miss it!

We've heard that some of our old consultancy friends are organising a technical event for SAS practitioners later this year. Details, such as the agenda, are still to be finalised, but what we do know is that it'll be on Tuesday 12th December at the MIC Centre in London.

If you like seeing real SAS code and would like to improve your coding skills, this could be a must-attend event for you. Likely topics include ODS, SAS programming efficiency, macro language and other key aspects of the SAS System. Take a look at the organisers' web site for more information.

 

Return to top...

 

Testing SAS Skills

Certification from SAS and Brainbench

If you're looking to recruit SAS skills and are keen to appoint the right person, you will doubtless have checked the CVs you've received to see if your candidates have any SAS certifications. The SAS Certified Professional Program offers a range of certifications that allow candidates to prove their proficiency with SAS. Certifications range from Base Programming to Warehouse Development Specialist.

The tests are administered by Thomson Prometric on behalf of SAS. Having registered via the Prometric web site, and having paid the appropriate fee, the candidate must then choose a test site at which the candidate will take the test. Prometric have more than 2,400 sites worldwide. Upon attendance at the chosen site, the candidate will be asked to produce photographic identification before being allowed to complete the test. Results are immediately made available at the end of the test. Fees for tests vary regionally: expect to pay about £100 in the UK, and $150 in the US and Canada.

However, SAS are not the only suppliers of certification for SAS skills. Web-based Brainbench also offer certification. They don't offer the same range as SAS, i.e. they only offer two certifications: SAS 6.0 (Base), and SAS 8.2 (Base). However, their trump card (and also their weakness) is that their tests are conducted online. So, there's no need to make an appointment at a nearby test centre and to then travel to that test centre - the candidate can take the test at any time that is convenient to themselves. However, the online nature of the tests means that there's no way of confirming the true identity of the person taking the test. Results are offered immediately upon completion of the tests. Each test costs $50.

The Brainbench tests are very comprehensive - we know, we were involved in the development of the SAS 8.2 (Base) test. The test is designed for experienced programmers and measures candidates' knowledge of the base package of SAS 8.2.

If you have a shortlist of candidates whom you are calling back for a second interview, consider asking them to each take a Brainbench test at your site as part of the second interview process. The cost to your company ($50 per test) is insignificant compared with the expense of recruiting somebody who is subsequently revealed to need a lot of unexpected training!

 

Return to top...

 

Why Elvis?

An unusual choice?

In the previous issue we mentioned Elvis. A number of you wrote to ask where the name came from. Well, Chris Long at Oceanview Consultancy tells us: The name arose because I was trying to avoid the normal contrived-acronym-syndrome; its name in development was 'Log Viewer', which became 'LV', which sounded a bit like Elvis.

So now you know.

 

Return to top...

 

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.

 

Return to top...

 

New Macro Options

More control when macro debugging

One of Elvis's strengths is in its comprehension of nested macros, and the way it clearly displays nested macros.

If you're heavily into SAS macros, you'll be interested to know of these new V9 macro system options:

  • The MPRINTNEST system option enables the macro nesting information to be displayed in the MPRINT output in the SAS log.

  • The MLOGICNEST system option enables the macro nesting information to be displayed in the SAS log.

  • The MINDELIMITER system option specifies the character to be used as the delimiter for the macro IN operator.

  • The MCOMPILENOTE system option specifies that a NOTE be issued to the SAS log when the compilation of a macro is completed.

  • The MAUTOLOCDISPLAY system option specifies that the source location of the autocall macro be displayed in the SAS log when the autocall macro is invoked.

There are also new statements, functions, and a %macro statement option. See the documentation for details. Russ Tyndall's Give Your Macro Code an Extreme Makeover (available by FTP from SAS Support) offers a lot of useful insights into using some of the new V9 macro functions and capabilities.

 

Return to top...

 

Sparklines

A useful technique for presenting data

Edward Tufte is a world renowned expert on information graphics, i.e. the science of presenting information in a graphical format. In his recent publication named Beautiful Evidence, Mr Tufte formally introduced the concept of sparklines - small, high resolution graphics embedded in a context of words, numbers, or images. You can read large parts of a draft of the sparklines section of Mr Tufte's book in the discussion thread he started on his site in 2004.

As illustrated in Mr Tufte's book, sparklines are an extremely powerful means of communicating information. I think they're at their most powerful when used within a paragraph of text, almost as if they were a word. For example, we had some very hot weather earlier this month, but it's now reduced to a more comfortable level, as you can see: Example sparkline. The sparkline neatly conveys all of the information without interrupting the flow or layout of the text. There are many variations on the sparklines theme, all of which are discussed in Beautiful Evidence.

If you want to experiment with using sparklines, you might like to try BitWorking's sparkline generator. It's a neat and simple web-based means of getting a sparkline for your data. Alternatively, if you visit Bissantz's page on sparklines, you'll see that they produce SparkMaker (an add-in for Microsoft Office that lets you create your own sparklines in Word, Excel, PowerPoint, or HTML documents) and SparkFonts (TrueType Fonts for the character-oriented generation of sparklines). And finally, you might find Sparklines for Excel a useful tool for experimentation.

However, as a SAS practitioner, I'm sure you're thinking to yourself "I'll bet SAS/GRAPH can do sparklines neatly", and you'd be right of course! The following basic macro, and example invocation, produces a very effective sparkline:

%macro spark(data= /* Name of input data set */
            ,hpixels=50 /* Length of spark line (pixels) */
            ,vpixels=11 /* Height of spark line (pixels) */
            ,xvar= /* Variable to plot on X-axis */
            ,yvar= /* Variable to plot on Y-axis */
            ,gdevice=gif /* Output graphics device */
            ,cmin= /* Colour of symbol displayed at minimum data point */
            ,cmax= /* Colour of symbol displayed at maximum data point */
            ,clast= /* Colour of symbol displayed at last data point */
            ,hmin=1 /* Height of symbol displayed at minimum data point */
            ,hmax=1 /* Height of symbol displayed at maximum data point */
            ,hlast=1 /* Height of symbol displayed at last data point */
            ,vmin=dot /* Symbol displayed at minimum data point */
            ,vmax=dot /* Symbol displayed at maximum data point */
            ,vlast=dot /* Symbol displayed at last data point */
                      /* Name and location of output graphics file */
            ,outfile=%sysfunc(pathname(WORK))/spark.&gdevice
            ,tidy=y /* Delete temporary data sets prior to termination? */
            );

%put **********************************************************************;
%put Parameter values to be used by &sysmacroname are:;
%put _local_;
%put **********************************************************************;

/***********
/ Notes.
/ 1. The names of all temporary data sets are prefixed with the name of this
/ macro (&sysmacroname).
/ 2. All temporary data sets are deleted prior to termination of this macro
/ (conditional upon the value of the TIDY parameter).
/ 3. Expect the following messages:
/ NOTE: <nnn> observation(s) contained a MISSING value for the minyvar * <yvar> request.
/ NOTE: <nnn> observation(s) contained a MISSING value for the maxyvar * <yvar> request.
/ NOTE: <nnn> observation(s) contained a MISSING value for the lastair * <yvar> request.
/
************/

/************
/ STEP 1. Put minimum/maximum points into separate data
/ sets (one row in each). This is done regardless
/ of whether the information is actually required.
************/
data _&sysmacroname._min (keep=xvar4minyvar minyvar)
     _&sysmacroname._max (keep=xvar4maxyvar maxyvar)
     ;
  set &data end=finish;
 
  retain minxvar maxxvar;
  if _n_ eq 1 or &xvar lt minxvar then
  do;
    minxvar = &xvar;
  end;
  if _n_ eq 1 or &xvar gt maxxvar then
  do;
    maxxvar = &xvar;
  end;
 
  retain xvar4minyvar minyvar;
  if _n_ eq 1 or &yvar lt minyvar then
  do;
    xvar4minyvar = &xvar;
    minyvar = &yvar;
  end;
 
  retain xvar4maxyvar maxyvar;
  if _n_ eq 1 or &yvar gt maxyvar then
  do;
    xvar4maxyvar = &xvar;
    maxyvar = &yvar;
  end;
 
  if finish then
  do; /* Save and then write-out the values for informational purposes */
    OUTPUT;
    call symput('MINXVAR',compress(minxvar,'BEST.'));
    call symput('MAXXVAR',compress(maxxvar,'BEST.'));
    call symput('MINYVAR',compress(minyvar,'BEST.'));
    call symput('MAXYVAR',compress(maxyvar,'BEST.'));
  end;
run;
%put &sysmacroname: MINXVAR=&minxvar, MAXXVAR=&maxxvar;
%put &sysmacroname: MINYVAR=&minyvar, MAXYVAR=&maxyvar;

/************
/ STEP 2. Merge the min and max information with the actual
/ plot data.
/ Output data set will contain five columns: the
/ X and Y variables, plus variables for min, max,
/ and last.
/ This is all done regardless of whether the
/ information is actually required.
************/
data _&sysmacroname._data_minmaxlast;
  merge &data (keep=&xvar &yvar)
        _&sysmacroname._min(rename=(xvar4minyvar=&xvar))
        _&sysmacroname._max(rename=(xvar4maxyvar=&xvar))
        end=finish
        ;
  by &xvar;
  if finish then
    last&yvar=&yvar;
run;

/************
/ STEP 3. Are any specific points actually required? This
/ is interpreted from the fact that no colour
/ was specified.
/ For those that are not required, the plot
/ symbol is set to NONE.
************/
%if %length(&cmin) eq 0 %then %let vmin = NONE;
%if %length(&cmax) eq 0 %then %let vmax = NONE;
%if %length(&clast) eq 0 %then %let vlast = NONE;

/************
/ STEP 4. Produce the plot.
/ Need to set goptions, then, specify name and
/ location of output graphics file, then specify
/ invisible axes, then specify symbols for the
/ line (always visible) and the min/max/last points
/ (conditionally visible).
************/
goptions reset=all
         device=&gdevice
         hsize=&hpixels.pt vsize=&vpixels.pt
         gaccess=gsasfile
         ;
filename gsasfile "&outfile";
axis1 order=(&minxvar &maxxvar) label=none value=none major=none minor=none color=white;
axis2 order=(&minyvar &maxyvar) label=none value=none major=none minor=none color=white;
symbol1 c=black i=join v=none ;
symbol2 c=&cmin h=&hmin v=&vmin;
symbol3 c=&cmax h=&hmax v=&vmax;
symbol4 c=&clast h=&hlast v=&vlast;
proc gplot data=_&sysmacroname._data_minmaxlast;
  plot (&yvar minyvar maxyvar last&yvar) * &xvar / overlay
       noframe
       haxis=axis1
       vaxis=axis2
       ;
run; quit;
filename gsasfile clear;

/************
/ STEP 5. Conditionally delete temporary data sets.
************/
%if %upcase(%substr(&tidy,1,1)) eq Y %then
%do;
  proc datasets lib=work nolist;
  delete _&sysmacroname._:;
  quit;
%end;

%mend spark;

options mprint;
%spark(data=sashelp.air
      ,xvar=date
      ,yvar=air
      ,cmin=red
      ,cmax=lime
      ,clast=orange
      ,outfile=c:\temp\spark.&gdevice
      ,tidy=n
      );

We'd love to see your own code and sparklines. Please send them to note.editor@rtsl.eu.

 

Return to top...

 

SAS(r) With Style

Why use eight functions when one will do?!

A recent unofficial SAS weblog article drew my attention back to the new character functions in SAS V9. I guess I should stop calling them new since V9 has been with us for years now; anyway, the article itself was actually a reference to a SAS Technology Report article. The nub of the article was that V9 allows you to replace:

TRIM(LEFT(X1)) || ' ' || TRIM(LEFT(X2)) || ' ' || TRIM(LEFT(X3)) || ' ' || TRIM(LEFT(X4))

with:

CATX(' ', OF X1-X4)

Neat, huh?!

 

Return to top...

Advertisement

 

Diary

 

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.


World-wide events

November 2006
1 - 2, SAS Forum UK, Birmingham, England. Annual conference for UK SAS practitioners
27 - 28, XPday, London, England. Annual Agile Software Development conference. International conference for project managers, developers and testers.

April 2007
16 - 19, SGF 2007 (SAS Global Forum, the renamed SUGI), Orlando, Florida, USA. Premier SAS conference world-wide

May 2007
22 - 24, SFI (SAS Forum International), Stockholm, Sweden. Business-focused SAS conference in Europe

June 2007
3 - 6, PharmaSUG (Pharmaceutical SAS User Group), Colorado, USA. International conference for SAS practitioners in the pharmaceutical field
?? - ??, XP2007 (eXtreme Programming), date & location to be determined. European conference on eXtreme Programming and Agile processes in software engineering

August 2007
13 - 18, Agile2007 (Agile Development Conference), Washington DC, USA. US conference on eXtreme Programming and Agile processes in software engineering

October 2007
8 - 10, PhUSE (Pharmaceutical Users Software Exchange), Madrid, Spain. European forum for programmers in the pharmaceutical industry

 

Return to top...

 

Miscellany - Joining, leaving, back-issues, and legal bits

 

You can subscribe and unsubscribe by visiting our web site at www.rtsl.eu. 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@rtsl.eu.

NOTE: (c) 2006 Ratcliffe Technical Services Limited. All rights reserved.
5 Willow Close, Bexley, Kent, GB-DA5 1QY, England.

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 2,855 subscribers worldwide.

This is a valid HTML 4.01 Transitional document

 

Return to top...