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 - 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.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Filtering rows with the WHERE statement1m 52s
-
(Locked)
Combining expressions in a WHERE statement58s
-
(Locked)
Demo: Filtering rows with basic operators5m 54s
-
(Locked)
Using special WHERE operators1m 17s
-
(Locked)
Creating and using macro variables2m 6s
-
Demo: Filtering rows using macro variables3m 40s
-
(Locked)
-
-