The WHERE statement is a substitute to IF statement when it comes to subsetting a data set.
WHERE (condition is true) => It refers to subsetting a dataset.
Task1 : Suppose you want to select only section A students. You need to filter Section variable equals to A using where clause.
where section EQ “A” => This would tell SAS to select only section which is equals to values “A”.
You can also write where section = “A”. This statement serves the same purpose.
|&||AND||Both conditions true|
||||OR||Either condition true|
|~ or ^||NOT||Reverse the statement|
Task2: Suppose you want to select section A and B students. You need to filter Section variable
equals to A or B using where clause.
where section IN (“A” “B”) => This would tell SAS to select those record where section is equals to either A or B values.
- If-Then-Else statement in SAS Programming
- Introduction to SAS programming
- How to import External Data from Excel or Text file into SAS Programming?
- How to Create or Modify a Variable in SAS Programming?
- Contains and Between-And operators in SAS Programming
- How to drop variables from a dataset in SAS Programming?
- IS MISSING and IS NOT MISSING Operators in SAS Programming
- Like Operator in SAS Programming
- How to import data into SAS?
- SAS | How to specify a list of Variables?
- SAS | How to read character of varying length using COLON Modifier
- SAS | How to read character using Ampersand(&)
- SAS | Date Formats and Informats
- SAS | Delete Empty Rows
- SAS | COALESCE Function with Examples
- SAS : How to Display Current Date?
- SAS | COMPRESS Function with Examples
- Switch case statement in Octave GNU
- Difference between Functional Programming and Object Oriented Programming
- Compute Variance and Standard Deviation of a value in R Programming - var() and sd() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.