The paper covers setting up base SAS to do date calculations based on business days. The paper walks through creating a business day interval and working with intck and intnx to count and increment dates based on business days.
SAS® practitioners are frequently required to present variables in an output data file in a particular order, or standards may require variables in a production data file to be in a particular order. This paper and presentation offer several methods for reordering variables in a data file, encompassing both DATA step and procedural methods. Relative efficiency and elegance of the solutions will be discussed.
How much do you know about SAS? Are you an expert or just a newbie? Test your SAS skills with SAS Jeopardy!, an interactive game that asks about common SAS concepts. It's SAS Programmers' Favorite Quiz Show!
PROC SQL is a powerful procedure that leverages the syntax of the American National Standards Institute’s Structured Query Language (SQL). It is often used to create complex reports from multiple tables which are related by a common key, or column. Joins or subqueries can be used interchangeably to create reports from related tables. Almost always, for a query that uses a join, there is an equivalent query which accomplishes the same task using a subquery, and vice versa. This paper compares the coding of different, but equivalent, queries visually and in terms of time complexity. In addition, the reader will be introduced to several large data sets, available online in SAS data format.
SAS® Functions provide amazing power to your DATA step programming. Some of these functions are essential—some of them save you writing volumes of unnecessary code. This paper covers some of the most useful SAS functions. Some of these functions may be new to you and they will change the way you program and approach common programming tasks.
The majority of the functions described in this presentation work with character data. There are functions that search for strings, others that can find and replace strings or join strings together. Still others that can measure the spelling distance between two strings (useful for "fuzzy" matching). Some of the newest and most amazing functions are not functions at all, but call routines. Did you know that you can sort values within an observation? Did you know that not only can you identify the largest or smallest value in a list of variables, but you can identify the second or third or nth largest of smallest value? I hope this abstract piques your interest.
In this paper aimed at SAS® programmers who have limited experience with data step programming, we discuss the basics of Data-Driven Programming, first by defining Data-Driven Programming, and then by showing several easy to learn techniques to get a novice or intermediate programmer started using Data-Driven Programming in their own work. We discuss using PROC SQL SELECT INTO to push information into macro variables; PROC CONTENTS and the dictionary tables to query metadata; using an external file to drive logic; and generating and applying formats and labels automatically.
Prior to reading this paper, programmers should be familiar with the basics of the data step; should be able to import data from external files; basic understanding of formats and variable labels; and should be aware of both what a macro variable is and what a macro is. Knowledge of macro programming is not a prerequisite for understanding this paper’s concepts.
I received a “cold call” email from a SAS user in Europe that asked my assistance in tracking down unbalanced quotes in her SAS code. This interactive, audience participation (hopefully) presentation looks at multiple possible solutions to the problem.
Cleaning data and generating reports can sometimes involve using the same pieces of information or code over and over again. This can consist of running similar programs one at a time in a specific sequence or updating multiple macro variables or fields. Related programs might need to import the same exact data resulting in that data being read in multiple times. These approaches are redundant, prone to errors, and can be very time consuming. By using macro variables or recognizing similarities in the code and condensing them into fewer programs, it is possible to increase efficiency and reduce the need for copy and pasting. This paper will go over some techniques that help reduce repetitive tasks by recognizing parts of code that can be condensed. Topics include using %LET and PROC SQL INTO statements to both create macro variables and use them to reference commonly used dates, folder paths, dataset names and variables. It will also discuss how to transform these macro variables to accommodate different formats such as alternate date styles. The last topic will examine using the %INCLUDE statement to run multiple programs from one main program, eliminating the need to run those programs one at a time.
How do I like SAS®? Let me count the ways.... There are numerous instances where LIKE or LIKE operators can be used in SAS - and all of them are useful. This paper will walk through such uses of LIKE as: using the LIKE condition to perform pattern-matching; searches and joins with that smooth LIKE operator (and the NOT LIKE operator); the SOUNDS LIKE operator; and PROC SQL CREATE TABLE LIKE.
This paper is intended as a brief survey of techniques for preventing unwanted blank values when reading in raw data, identifying and handling blank values in existing datasets, and methods for creating blank values in a dataset. It will also briefly describe some of the challenges that blank values can present to downstream programming and data analytics.
A common source of unwanted blank values occurs as invalid numeric values (typically dates) in raw data are converted in SAS as a blank. Programming techniques can be deployed to identify these values.
Blank values can cause problems with assignment statements, counts, calculations and data modeling. The good news is that SAS has a variety of procedures and options for identifying and handling blank values in datasets.
On the flip side, other programs use values such as NA or 999 to identify missing data, which need to be converted to blank in SAS. These “wanted” blanks can be easily created using basic SAS programming techniques.
Blank values in data are not necessarily bad if the programmer is aware of them and if the meaning of “blank” is clear to all users. For example, “I took 20 shots and made zero” is quite different than “I took 20 shots and made _______.” I recommend a blank value only signify data which was not recorded or captured.
Although merging is one of the most frequently performed operations when manipulating SAS datasets, there are many problems which can occur, some of which can be rather subtle. This paper examines several common issues, provides examples to illustrate what can go wrong and why, and discusses best practices to avoid unintended consequences when merging.
Steven C. Black
Stop cutting and pasting old code into new programs, stop worrying about forgetting or misplacing really neat code, let SAS remember it for you! All through the use of Keyboard Macros! The term Keyboard macro is a mild misnomer as they are not really macros or at least not in the way that most SAS programmers think of macros. They should really be called Keyboard Awesomeness. As these allow you to bring back all that awesome code you wrote. The title may be an exaggeration but I have found these to really speed up my programming. In this paper I will demonstrate how to create, use, and transfer keyboard macros. I will also discuss a few of the more in-depth aspects of Keyboard Macros with the intent that the reader will use and make them a part of their programming repertoire.
WHAT IS A KEYBAORD MACRO?
CREATING A KEYBOARD MACRO
CALLING A KEYBOARD MACRO
MANAGING THE MACROS
CREATING A SHORTCUT KEY
CREATING THE CURRENT DATE KEYBOARD MACRO
Pinnacle 21 is a widely used tool for evaluating SDTM and ADaM datasets that are to be submitted to regulatory authorities (FDA and PMDA) for approval of a drug or biologic product. Pinnacle 21 evaluates these SDTM and ADaM datatsets against published validation rules and produces a spreadsheet listing errors and warnings based on the validation rules. Have you ever wondered how to deal with all the errors and warnings that are found in a Pinnacle 21 report? In this Hands On Workshop you will learn a strategy for annotating Pinnacle 21 Reports to help you keep track of the types of errors and warnings that Pinnacle 21 produces. Attendees in this Hands On Workshop will learn practical steps for annotating a Pinnacle 21 Report to deal with the types of errors and warnings.