Example 8.15 Applying the Same Operation to a Group of Variables

Goal

Apply operations to selected numeric and character variables in a data set by using arrays without explicitly listing all the variables' names.

Example Features

Featured StepDATA step
Featured Step Options and StatementsARRAY statement, _NUMERIC_ and _CHARACTER_ lists

Input Data Set

Data set GLUCOSE records several glucose measurements at different times for four patients. The data set has allocated four variables to hold the evaluations of the four glucose results. When this data set is created, the evaluations are not completed and are coded with question marks (?).

 GLUCOSE patient_ glucose_ eval_ glucose_ glucose_ glucose_ Obs id fast fast 1hr eval_1hr 2hr eval_2hr 4hr ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.