Assigning Values Conditionally Using SELECT Groups

The Basics of Using SELECT Groups

You can use SELECT groups in DATA steps to perform conditional processing.
Syntax, SELECT group:
SELECT <(select-expression)>;
WHEN-1 (when-expression-1<..., when-expression-n>) statement;
<...WHEN-n (when-expression-1 <..., when-expression-n>) statement;>
<OTHERWISE statement;>
END;
  • SELECT begins a SELECT group.
  • select-expression specifies any SAS expression that evaluates to a single value.
  • WHEN identifies SAS statements that are executed when a particular condition is true.
  • when-expression specifies any SAS expression, including a compound expression. You must specify at least one when-expression.
  • statement is any executable ...

Get SAS Certification Prep Guide, 4th 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.