Roland's SAS tips and techniques

Last Updated:  22 Feb 2016


Your most important source of information on how to use SAS software will always be the official documentation. This is available online and in this form it is easy to search for the topic of interest. You should refer to the online documentation often and learn what is there and how to navigate the site. The tips you can link to on this page do not overlap what you will find in the online documentation. They are mostly of a broader topic nature and aim to cover real-life situations you will encounter in your programming work. You can link to the online SAS documentation below. This page will allow you to navigate to older and newer versions.
SAS On-line Documentation

Sources of SAS tips

You can find a lot of good SAS tips on the Internet. Don't think of my web site as a definitive source. It certainly is not. I often look at the sas Technical Support site to see examples of usage and to attempt to resolve problems. This is the first place to look if you discover a problem since chances are, the problem is already known or there is a solution to it. You can search the Problem Notes by using the link below. There is a lot of focus on ODS these days so try searching on the word "style". It will give you a lot of useful information for improving the look of your ODS output.
Knowledge Base/Samples and SAS Notes/Search Problem Notes

Outside the official sas site there is the web site that has hundreds of useful tips and code that you can download. You can also search that site for the information you need just like you can the sas Technical Support site. There are plenty of useful examples in the official online sas documentation that you can link to above so there are plenty of tips out there. And if you are really stuck then there is the newsgroup. So long as you have posting access, you can post your questions or problems there and somebody should respond quite quickly. There is also a mailing list called SAS-L that sits behind that newsgroup. For information on how to subscribe to the list, then check out the web site.

My SAS tips

I started writing sas code in late 1986 and have been doing so ever since. I've encountered all sorts of problems over the course of these years so I have a lot of tips to give, based on my experience in coding with the language. Allow my "pain" to be your "gain" as you read the tips you can link to below. As I think of other tips, I will add new pages to this list of links in the relevant section.

Key topics:
Code documentation
Writing SAS macros
SAS Speed Tips  (Feb 2016)
How to become a good SAS programmer (Jun 2015)
Bad SAS Coding Style
SAS Macro Design
Macro Visioning
Macro version numbers

Metadata-Driven SDTM Creation  (Feb 2016)

Anonymization (De-Identification)
Anonymization (De-Identification) Programming Tips  (Nov 2015)

Multiprocessing using MP Connect
Sharing Resources with Remote Sessions
Managing your Multiprocessing Sessions
Rsubmitter - the Game Changer

Data mapping and pooling:
User Guide to %lstattrib
The Free Lunch is Over: Pooled Clinical Trials Analysis
Compressing Pooled Datasets

Clinical trials stuff:
Worst-case EPOCH merging with SDTM and ADaM
Using a "programming plan" for clinical reporting
Improving Bootstrap Performance of SAS Code
LOCF (Last Observation Carried Forward) processing
Merging with a dose
Time-to-event processing
Your "validated" clinical reporting system
Supercharge your Clinical Reporting Function

ODS and cosmetic stuff:
Solid lines with proc report
In-text tables using SAS
Using ODS to make your tables look pretty
Choosing colors for your html output
Fancy Printing ODS->html->MS Office
How to Control Column Widths for Proc Report ODS Output
ODS and the end of data _null_ reporting
Improving the look of text for SAS/GRAPH

Getting Started with ODS PDF
A "Warnings" dataset and Reporting it
Moving PDF bookmarks using SAS v9.2

SQL shorter than sas code  (Aug 2015)
SQL for deriving Treatment Emergent Adverse Events
SQL for Exclusive Joins  (Apr 2015)
Do not use SELECT COUNT(*) unless you really need to
SQL for checking variable names
NATURAL Joins and their Uses

Other topics:
Using the dataset label to automate reporting
Hash Objects for Fast Merging   (Apr 2015)
A v6 to v8 data migration
Connect to Oracle and read System Tables
Converting character variables to numeric
Deadly errors you can make
When SAS programs become too long
Use %nrstr() when you "call execute" a macro
"Communicating" with a sas program
Floating point number accuracy
Create a single missing obs from a zero obs dataset
Resolving macro variables inside single quotes
Macro Quoting Functions
Testing whether macro parameters are set
Fun with formats
Using Boolean expressions in calculations
Deleting datasets more than a month old
Testing for the existence of a global macro variable
Reading a data set using pure macro code
Quoting quoted text with SAS code and macro language
Quoting text with quotes in it
Combining data sets with identically named character variable of different lengths
proc sort nodup
Bulk runs of many sas jobs under MS Windows
Creating a scale using an annotate dataset
Deleting any or all global macro variables
"Call symput" absolutely everything
Hacking using sas
Extending the power of SAS software using other software packages
%complibs -- comparing whole libraries
macro nomprint mprint %
Multilabel formats
Conditional line statement in proc report
data _null_ unleashed
Stacked column reports with data _null_
data _null_ tips and techniques
Left-aligning footnotes
Put (_all_) (=)


Go back to the home page.

E-mail the macro and web site author.