Contains and Between-And operators in SAS Programming
- BETWEEN-AND Operator: Between Two Numbers
Task 1: Suppose you want to select scores whose values are greater than or equal to 50 and less than or equal to 90.data readin;inputname$Section$ Score;cards;Raj A 80Atul A 77Priya B 45Sandeep A 95Rahul C 84Shreya C 44;run;data readin1;setreadin;whereScorebetween50and90;run;chevron_rightfilter_nonewhere Score between 50 and 90 => This would tell SAS to select values through 50 and 90 (not 51 to 89).
This can also be written like:
where Score GE 50 and Score LE 90;
-
CONTAINS Operator: Searching specific character
Task 2: Suppose you want to select only those observations in which students’ name contain ‘hil’.
data readin;inputname$Section$ Score;cards;Raj A 80Atul A 77Priya B 45Sandeep A 95Rahil C 84Sahil B 44;run;data readin1;setreadin;wherenamecontains'hil';run;chevron_rightfilter_nonewhere name contains ‘hil’ => This would tell SAS to select observations having the values Rahil, Sahil for the variable NAME.
Note: The CONTAINS operator is case sensitive.
Recommended Posts:
- IS MISSING and IS NOT MISSING Operators in SAS Programming
- Difference between Functional Programming and Object Oriented Programming
- What is the difference between = (Assignment) and == (Equal to) operators
- Introduction to SAS programming
- Use of FLAG in programming
- Where Statement in SAS Programming
- Like Operator in SAS Programming
- If-Then-Else statement in SAS Programming
- Introduction to Programming Languages
- Introduction to Swift Programming
- Swift Programming Language
- Which Programming Language to Choose?
- 5 Most Difficult Programming Languages of the World
- Object-Oriented Programming in Ruby | Set 1
- How to Create or Modify a Variable in SAS Programming?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.





