SAS tips and tricks

These pages listed here are based on SAS seminars I gave in 1999-2000, aimed at epidemiology doctoral students in my department. I no longer use SAS, and these files are not maintained or updated. The code is based on SAS version 6.

My SAS code for estimating and modelling relative survival can be found here

Index of SAS tips and tricks

Slides (PDF format) from other presenters in the same series

Extended index (with short summary of each page)

SAS Tips: Accurately calculating age in only one line

Accurately calculating age in only one line

SAS Tips: autocall libraries

An autocall library contains files that define SAS macros. If you regularly use user-written SAS macros, it is efficient to store these macros in a separate directory

SAS Tips: Calculating age at diagnosis from date of birth and diagnosis date

Calculating age at diagnosis from date of birth (extracted fron Swedish ID number) and diagnosis date

SAS Tips: Categorising a continuous variable into quantiles

Three approaches for categorising a continuous variable into quantiles.

SAS Tips: Converting variable types from character to numeric (and vice versa)

Converting variable types from character to numeric (and vice versa)

SAS Tips: Customised notes and warnings

How to use customised notes and warnings in the SAS log

SAS Tips: Data step processing within by groups

Illustration of the FIRST. and LAST. variables for data step processing within by groups.

SAS Tips: Estimating ratios of proportions (risk ratios)

Approaches to estimating ratios of proportions (risk ratios)

SAS Tips: Formats and Informats

SAS Formats and Informats

SAS Tips: Introduction to arrays

SAS arrays are useful when we wish to perform a similar operation on a set of variables