Browsed by
Category: SAS

Significant Figures in SAS

Significant Figures in SAS

For three significant figures, the SAS Institute provides the following code snippet to accomplish the task. However, it is often useful to round to more or less than 3 significant figures. I’ve developed a macro to do so for my own use and am sharing the code below.

Searching for a string in an entire SAS library

Searching for a string in an entire SAS library

For the most part, experienced SAS programmers know where to look for the source data they need. In the pharmaceutical industry, we are familiar with CDISC standards and data structures. However, should the data standard be unfamiliar or the source datasets include new or unusual parameters, it may be prudent to have SAS look through the data on your behalf to save time. We can do this by making use of PROC CONTENTS and SAS macro loops with the forward…

Read More Read More

NONMEM ADDL Calculation and Compression in SAS

NONMEM ADDL Calculation and Compression in SAS

ADDL represents the number of additional doses that are copies of the current row, with the time since first dose (RTFD) increased at the regular dosing interval (II). This allows for the compression of dose records in the NONMEM dataset. To put it more eloquently: The NONMEM data item ADDL on a dose record expresses the number of additional implicit doses that should follow at a regular interval II. In the case where explicit doses exist, ADDL supports compacting them…

Read More Read More

SAS and the Forward Re-scan Rule

SAS and the Forward Re-scan Rule

The “Forward Re-scan Rule” (FRR) is used by SAS to resolve macro variables over several passes. This is especially useful when having one macro variable point to another macro variable, or when trying to resolve numbered macro variables. The SAS Advanced Prep Guide summarises the FRR as follows: When multiple ampersands or percent signs precede a name token, the macro processor resolves two ampersands (&&) to one ampersand (&), and re-scans the reference. To re-scan a reference, the macro processor…

Read More Read More

SAS LOCF For Multiple Variables

SAS LOCF For Multiple Variables

It is often necessary to replace missing measurements with the closest, previous measurement. This technique is referred to as LOCF (last observation carried forward). In this example, we will create a dataset with 4 columns: subject ID, visit number, body weight, and systolic blood pressure. Thereafter, we will sort the dataset to ensure it is in the order we expect. Never assume that your input will be appropriately sorted. Now we will define 2 macro variables, which are simply lists…

Read More Read More