CASE WHEN Statement and Some Functions in SQL SAS

Patrizia Castagno
3 min readApr 20, 2024

Learn with examples

This is a continuation of the previous blog post titled “Introduction to SAS”, “JOINS IN PROC SQL” and “Getting Started with PROC SQL in SAS: A Beginner’s Guide”. In this segment, we delve into the concept of “Case When,” which assists in selectively determining result values for each row/observation within a table. It also aids in creating variables based on specific conditions.

Syntax:

CASE <case-operand> /*this is useful when we have 1 variable */
when when-condition Then…

--

--

Patrizia Castagno

Physics and Data Science.Eagerly share insights and learn collaboratively in this growth-focused space.LinkedIn:www.linkedin.com/in/patrizia-castagno-diserafino