From the course: SAS® 9.4 Cert Prep: Part 03 Exploring and Validating Data

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

Combining expressions in a WHERE statement

Combining expressions in a WHERE statement - SAS Tutorial

From the course: SAS® 9.4 Cert Prep: Part 03 Exploring and Validating Data

Combining expressions in a WHERE statement

- [Instructor] You can combine multiple expressions with keywords AND or OR in a WHERE statement. In this example code, any rows that meet these two conditions are included in the PROC PRINT results. In this example, the OR keyword is used to provide multiple values. Notice that each condition has to include Type=. This can be tedious if there are several valid values that you want to include. A more efficient approach in this scenario is to use the IN operator to compare to a list of values. After typing the column name, you use the keyword IN, and in parentheses list the values, separated by commas or spaces. The IN operator works with both numeric and character values. Just keep in mind that character values are case sensitive and must be enclosed in quotation marks. You can also take advantage of the keyword NOT to reverse the logic of the IN operator.

Contents