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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.