O'Reilly logo

SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assigning Values Conditionally Using SELECT Groups

Overview

Earlier in this chapter, you learned to assign values conditionally using IF-THEN/ELSE statements. You can also use SELECT groups in DATA steps to perform conditional processing. A SELECT group contains these statements:
This statement...
Performs this action...
SELECT
begins a SELECT group.
WHEN
identifies SAS statements that are executed when a particular condition is true.
OTHERWISE (optional)
specifies a statement to be executed if no WHEN condition is met.
END
ends a SELECT group.
You can decide whether to use IF-THEN/ELSE statements or SELECT groups based on personal preference.
General form, SELECT group:
SELECT <(select-expression) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required