Beginner’s Techniques Track

Essential Programming Techniques Every SAS User Should Learn

Kirk Paul Lafler

SAS® software boasts countless functions, algorithms, procedures, options, methods, code constructs, and other features to help users automate and deploy solutions for specific tasks and problems, as well as to access, transform, analyze, and manage data. This paper identifies and shares essential programming techniques that a pragmatic user and programmer should learn. Topics include determining the number of by-group levels that exist within classification variables; data manipulation with the family of CAT functions; merging or joining multiple tables of data; performing table lookup operations with user-defined formats; creating single-value and value-list macro variables with PROC SQL; examining and processing the contents of value-list macro variables; determining the FIRST., LAST. and Between by-group rows; processing repetitive data with arrays; and using metadata to better understand the contents of SAS datasets.


Bring the Vampire out of the Shadows: Understanding the RETAIN and COUNT functions in SAS

Steven C. Black

In SAS® there are few things that can turn a good programmer into a pale, sleep deprived, shadow seeking individual like a RETAIN statement that is not working right.  In this paper I hope to provide a deeper understanding on how to better count on and count with the RETAIN statement in SAS.  I will illustrate a number of ways to count using the properties of the program data vector and provide some real life examples of how I have found using the RETAIN statement super helpful.  In the end I hope to bring out of the shadows and into the light the RETAIN and count functions.

Dating for SAS Programmers

Josh Horstman

Every SAS programmer needs to know how to get a date... no, not that kind of date. This paper will cover the fundamentals of working with SAS date values, time values, and date/time values. Topics will include constructing date and time values from their individual pieces, extracting their constituent elements, and converting between various types of dates. We'll also explore the extensive library of built-in SAS functions, formats, and informats for working with dates and times using in-depth examples. Finally, you'll learn how to answer that age-old question... when is Easter next year?

Let's Talk About Variable Attributes

Elizabeth Guerrero Angel

Variables can come in all shapes and sizes. Most data we receive are from external data sources, such as extracting data from a complex data entry system, reading in Excel spreadsheets, or importing text files with millions of observations. When combining data from various sources we often have to deal with different variable formats or names that are not functional. This presentation with cover novel solutions to these complex problems, in an easy to understand way, using PUT, INPUT, SUBSTR, and MDY functions. We will demonstrate how these frequently used functions can be used to change formats and fix dates, and can be combined with more complex code to and quickly rename long lists of variable. Variable characteristics in SAS can seem like a pesky problem that won’t go away, but we will help you navigate the world of variable attributes. The programming is demonstrated at a beginner’s level.

PROC DATASETS; The Swiss Army Knife of SAS Procedures

Michael Raithel

This paper highlights many of the major capabilities of PROC DATASETS. It discusses how it can be used as a tool to update variable information in a SAS data set; provide information on data set and catalog contents; delete data sets, catalogs, and indexes; repair damaged SAS data sets; rename files; create and manage audit trails; add, delete, and modify passwords; add and delete integrity constraints; and more. The paper contains examples of the various uses of PROC DATASETS that programmers can cut and paste into their own programs as a starting point. After reading this paper, a SAS programmer will have practical knowledge of the many different facets of this important SAS procedure.