A Macro to carry values through observations forwards or backwards over missing or 'null' values within a BY group or a SAS® data set

PharmaSUG 2017 - Paper BB10

A Macro to carry values through observations forwards or backwards over missing or 'null' values within a BY group or a SAS® data set.
Timothy J. Harrington, Dataceutics, inc;

 

ABSTRACT

This paper explains the structure of a macro and its usefulness for imputing missing or defined 'null' values with a prior or following quantity of a numeric or character column in a SAS® data set or BY group. The macro uses DICTIONARY.COLUMNS to determine the data type, carries values over multiple successive observations with missing or 'null' amounts. When the specified data set column is numeric, parameters can be passed to return the differences between each quantity and the first or last values of the by group or the successive differences between non-missing values. The 'null' value defaults to missing but can be user specified. Included in this paper are examples of practical applications, such as imputing missing dates and times of events since the first or most recent dose in PK data.  Click here to access the full article.