Roland's SAS® Macros

[This site is not connected with the SAS Institute]

(Author: Roland Rashleigh-Berry                                                                                              Date: 02 May 2008)
Latest updates ---- Macro download ---- Where I work ---- My CV

google
only search this site

newsletters

To keep you up to date with news about this web site, I will issue a newsletter from time to time. I will probably issue one about every three months but sometimes it will be more frequent, other times less. It all depends on how many changes I make. You can link to all the current and past newsletters below. They are in MS Word format so that they are suitable for printing. If you don't have MS Word (I don't) then there is always OpenOffice software you can download for free which will read and print these documents.

September 2007 Newsletter
January 2008 Newsletter
April 2008 Newsletter

sasautos extensions

Old-time SAS programmers will be familiar with the macros %left and %trim. These have been supplied with the sasautos library distributed with copies of SAS for many years. They behave like macro functions and yet they are macros. They have now been made redundant, because %sysfunc calls can replace them, but %left and %trim have been used by programmers for years not knowing or caring whether they are macro language functions or macros. You use them in the same way. There is no rationale as to why some of these macros are there and some not. You might be familiar with the %words macro that you can find on the SAS Technical Support site. That has never been a member of the supplied sasautos library and yet it is obviously a useful macro to have there. The point is, it is up to you to decide what utility macros you want to make available and to create them if you need them.

Obvious candidates for adding to the sasautos library are the very useful function calls used in SCL for extracting variable and data set information. In SCL you need to open the data set and give it a file handle before you can get this information but it is easy enough to write this code into a macro in a way that the whole macro behaves like a macro function. I have used this technique for many of the sasautos extension macros. This is not at all efficient when you are making many of these calls, because the data sets are being opened and closed multiple times when once would have been better, but when you are developing more complex macros, such as I have done for some clinical reporting macros, then the convenience outweighs the efficiency considerations.

Since 1987 I have been building up my collection of low-level, general-purpose utility macros. Every time I have spotted the need for one, I have written one. I have asked many other people to tell me what macros would be useful and created them if I could see a need. The result is that my collection of macros is very comprehensive and the number of them stands at over 150. If you ever think of a macro, the chances are that it is already in my macro collection. I would put that probability at higher than 95% so my collection is a very good place to start looking if you are thinking you need a macro to do something general-purpose and low-level, especially in the field of clinical reporting. You can get to these sasautos extension macros and their descriptions by clicking on this link.

All the macros can be downloaded as a zip file here.

How to use the macros

All the macros you can download here are intended to be put in a library and included on the sasautos path. The major macros often call lower-level macros so these will only work correctly if all these macros are made available and declared to the sasautos path. I sometimes get asked by email why the major macros don't work and why it is complicated by them calling other macros but this is the whole point of this web site and the approach it takes. It is all to do with the "sasautos extensions" idea that I advocate and by that I mean building your own library full of all the utility macros you will ever need and putting them on the sasautos path. If you do this right then all the macros will work correctly and you should be far more productive in your work.

SAS software tips and techniques

As I think of them, I will be adding my own sas tips and techniques to this site. You can get to them by clicking on this link.

Roland's Graphical Patient Profiler

My latest project, now nearly complete, is a graphical patient profiler, very much like the one written by Ya Huang and described in the following article.
A Low Cost Graphical Patient Profiler with SAS MetaViewApplet

The patient profiler described in the article is similar in parts to the PPD Patient Profiles.
PPD Patient Profiles

I have written an entirely independent version of a graphical patient profiler, inspired by Ya Huang's creation, which I thought was a brilliant design achievement. I have put a lot of man-hours of my free time into this as I consider it to be a very important enhancement to the clinical trials process. Clinicians, who follow the progress of clinical trials, will know about the serious adverse events and the successes. They will probably find this out via telephone calls or faxes because the data from the clinical trial will be "unclean". Indeed, I have had access to this unclean data from many clinical trials and it is truly unclean, even with wrong years for events. It takes months to sort out the irregularities. But there is a lot of useful data in there that could be used for the benefit of patient safety. If the clinician had access to the data and could visualise the situation, they could, perhaps, spot danger-signals for patients on the trial, based on the profile of patients who have already withdrawn from the trial or patients who had suffered drug-related adverse events. If the data were clean enough to use, and the patient profiling software were good enough and flexible enough, then perhaps potential problems could be spotted in advance, much to the benefit of patient safety.

For these reasons stated, it is with much pride and pleasure that I have released my graphical patient profiler such that all can use it for free. It is now released as a compiled and stored macro that you can download from this web site. You can link to the patient profiler page below. Please use it and if you encounter bugs then please send me details.

Roland's Graphical Patient Profiler

Unix tutorials and shell scripts

As a sas programmer working on Linux/Unix, you may think you do not need to learn Unix beyond knowing how to use some of the common commands. This is largely true but if you work in a high-production environment, such as clinical trials reporting, then having a good knowledge of Unix commands and being able to write shell scripts can increase your efficiency and make your work easier, so learning more about it becomes worthwhile. To help you in this, I have written several pages to do with Unix and using it with SAS software.

If you have never written shell scripts before and your knowledge of Unix is limited then you are better off using this link.

If you already have a shell script library you use and you want to hunt for more useful tips and shell scripts then go direct to this page.

Clinical reporting macros %unistats and %npcttab

There are two major clinical reporting macros I wrote for the Spectre (Clinical) reporting system named %npcttab and %unistats. They rely on some other macros. They are designed so that you can run them independently of the clinical reporting system they were designed to work with. All the documentation on how to use them comes with the Spectre (Clinical) e-book that you can download in the next section but to give you an idea on how the %unistats macro works and what it does there is a short PowerPoint demonstration you can link to below. You will see actual code run and output produced.
unistats.pps

Through late 2007 and early 2008 I put a lot of work into upgrading these macros so the current documentation is not up to date. I'll be updating and moving this documentation out of the Spectre e-book and into this web site when and if time allows. This may take some time as it has now reached the stage when I must stop working on these macros due to other commitments. I now no longer support these macros for users who use them for free. As for fixing bugs, although these may get reported to me it may take me a long time to fix them. I use these macros myself and tend to fix bugs when they affect my own work. They are highly complex macros and fixing a bug can take up to 8 hours. This is time I can no longer afford. The only way I can justify this work is if users have a support contract with me.

Spectre (Clinical)

Spectre (Clinical) is a clinical reporting system I wrote from late 2003 onwards. It used to have its own web site but now you have to download it and set it up on your PC as an e-book. It is more suited to being an e-book as it is of an advanced technical nature and not something you can "dip into" and browse. It is a full and complete clinical reporting system with shell scripts, sas macros and extensive documentation. Its SAS macros are the same ones you can download from this web site so you will not find any more macros there.

You can download Spectre using the link at the end of this section. What follows is the current status of Spectre that you can download.
Bugs and changes log
spectre.zip (documentation) - 16 Feb 2008
macros.zip (macros) - 02 May 2008
scripts.zip (scripts) - 29 Jul 2007

Spectre (Clinical) can be downloaded from the following page which will also give instructions on how to set it up as an e-book.
Spectre download
 
 

E-mail the macro and web site author.

This site is a member of WebRing. 
To browse visit Here.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.