EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials SAS Tutorial SAS Operators
Secondary Sidebar
SAS Tutorial
  • Basic
    • What is SAS
    • Advantages of SAS
    • Career in SAS
    • SAS Command
    • SAS Operators
    • SAS Export to CSV
    • Loops in SAS
    • DO WHILE in SAS
    • SAS System Interview Questions
    • SSAS Interview Questions
    • SAS Visual Analytics
    • SAS Join
    • SAS Length
    • SAS INTNX
    • SAS Congruence
    • SAS LAG Function
    • SAS boxplot
    • SAS INTCK
    • SAS Find
    • SAS Grid
    • SAS Triangle Calculator
    • SAS KEEP
    • SAS YEAR Function
    • SAS Format
    • SAS Libname
    • SAS Rename
    • SAS Retain
    • SAS Base
    • SAS JMP
    • SAS Array
    • SAS Round
    • SAS DO Loop
    • SAS Index
    • SAS Datalines
    • SAS Model
    • SAS Logistic Regression
    • SAS Numeric to Character
    • SAS Label
    • SAS ODS
    • SAS Upcase
    • SAS Numeric Formats
    • SAS Nodupkey

Related Courses

SAS Certification Course

Data Visualization Courses

Business Intelligence Courses

SAS Operators

By Priya PedamkarPriya Pedamkar

SAS Operators

Introduction to SAS Operators

Statistical Analysis System refers to a suite of software created by SAS Institute and has the ability to provide multivariate advanced analytics with data management and predictive capabilities. SAS as the software is used to retrieve, alter, manage data from a variety of sources and perform data analysis on the same. here we will discuss the SAS Operators.

SAS is a fourth generation programming Language extensively used in Statistical and mathematical analysis of data for providing an enterprise-level solution to complex business needs.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,992 ratings)

SAS was initially developed in 1966 to cater to the life sciences industry with primary use being in predictive analysis using variance and regression legacy data, SAS further developed its ability with the incorporation of JMP to combine with the Graphical User interface option provided in early MAC, with the continuous development philosophy and advancement in computational ability of scientific systems and the increasing load of omnipresent data SAS introduced data mining features in 2005.

Further development in the suite provided various features like excel import, experimental designing,

As of now, SAS is extensively used in providing Customer intelligence solutions, SAS also finds huge applications in Banking industries with the ability to identify fraudulent transactions, SAS products are also used in government, retail, telecommunications and aerospace and for marketing optimization or high-performance computing.

The code structure of SAS Programming

The SAS program is built on the two building blocks:-

  • DATA STEP: It is used in dataset creation and variable assignment
  • PROC STEP: It is used to process the data

What are the Operators in SAS?

The SAS operators are symbols used in programming for arithmetic, logical or comparison operations.

For e.g.

  • Y = X + Z
  • Y > 5
  • P in (1,2,3,4,5)

Types of Operator in SAS

There are two major categories of operators in the SAS programming language which include Prefix Operators and Infix operators. The segregation between the two is based on the modus operandi of the operators.

  • Prefix Operators: It is a general expression used in defining the operators which are applied on the operands (are constants or variables that can be numeric or character) which follow the expression, the activity associated with the operators is applied immediately on the variable, expression, constants. Let us now try to understand examples of Prefix Operators
    • -y
    • -cos(x)
    • +(x*y)

It is also to be mentioned that the word NOT and its equivalent symbols are also considered as prefix operators.

  • Infix Operators: They are referred to those operators acting upon both the sides of the operators, these operators have generally involved in arithmetic as well as the logical operations in SAS programming. Subcategories of Infix operators are as follows
  • Arithmetic Operators
  • Logical Operators
  • Comparison Operators
  • Concatenation Operators
  • Maximum
  • Minimum

The Plus/Minus Anomaly

The questions arise in terms of a definition of plus and minus signs in SAS programming. Here one needs to understand the contextual inference of the Symbol, the easiest way to understand the scenario is when used in arithmetic calculations the plus/minus signs are considered as infix operators, Similarly, when used in the definition the symbols are categorized in Prefix operators.

In-depth analysis of Infix Operators

Different Infix operators used as follows:

  • Arithmetic operators: Referred to the operators used in carrying out the arithmetic computations in SAS, the list of operators can be found below with the result
Operator Description Syntax Result (x=8 and y=2)
+ Addition x+y 10
– Subtraction x-y 6
/ Division x/y 4
* Multiplication x*y 16
** Exponentiation x**y 64
  • Logical Operators: Referred to those operators which are used in determining the truth value of an expression
Operator Description Syntax Result (x=8 and y=2)
& AND E1 & E2 (x>2 & y > 3) gives 0
| OR E1 | E2 (x>2 & y > 3) is 1
~ NOT E1 ~ E2 NOT(x > 3) is 0
  1. AND Operator: The expression returns 1 if both the quantities linked by the AND operation are true
  2. OR Operator: The expression returns 1 if either of the quantities linked by the OR operation is true.
  3. NOT Operator: The NOT operator is a Logical operator it transposes the value of its operand to the logical opposite
  • Comparison Operators: They are referred to operators used to set up a comparison operation, or calculation with two variables, constants, or expressions. If the comparison is true, the result is 1. If the comparison is false, the result is 0.
Operator Description Syntax Result (x=8 and y=2)
= equal to E1=E2 (x=y) gives 0
~= not equal to E1~=E2 (x~=y) gives 1
> greater than E1>E2 (x>y) gives 1
< less than E1<E2 (x<y) gives 0
>= greater than or equal to E1>=E2 (x>=y) gives 1
<= less than or equal to E1<=E2 (x<=y) gives 0

IN operator in SAS is used in the comparison of expression in the left to a list of Expression on the right for e.g.

x IN (1,2,3,4,8,9,10) will give 1 for the above example

It is to be noted that the expression on the Value end must be constant.

Character operations can be performed in SAS, Character operands are compared character by character from left to right. Two character values of unequal length are compared with the assumptions that blanks are attached to the end of the shorter string before the comparison is made.

  • MIN/MAX operators: The MIN/MAX operators in SAS are used to find the minimum and maximum value of two quantities
Operator Description Syntax Result (x=8 and y=2)
<> MAX E1<>E2 x<>y gives 8
>< MIN E1><E2 x><y gives 2
  • Concatenation Operator: The Concatenation operator in SAS is used to integrate two strings.
Operator Description Syntax Result (x=Good and y=Bye)
|| Concatenation E1||E2 x||y gives GoodBye

 The length of the resulting string is equal to the sum of the length of the strings involved in the Concatenation operations,

Order of Evaluation

The order of evaluation in a compound statement is dependent on the expression type:-

  • Right to left -> the prefix operators, as well as the Exponential and MIN/MAX operators, uses the Right to left order of evaluation. Let us understand this with an example

Let us consider a SAS operation x=4**5**6 this will be evaluated as x= (4**(5**6))

  • Left to right -> the operators such as addition, subtractions, multiplication, and division with comparison and logical AND, logical OR are evaluated as from left to right.

SAS also provides several other operators that are used only with certain SAS statements. The WHERE statement uses a special group of SAS operators, valid only when used with WHERE expressions.

Recommended Articles

This has been a guide to SAS Operators. Here we have discussed different types of SAS Operators with examples and Order of Evaluation. You may also look at the following article to learn more –

  1. List of MySQL Operators
  2. C Operators with Syntax and Examples
  3. SASS Interview Questions
  4. Multivariate Regression
Popular Course in this category
SAS Training (9 Courses, 10+ Projects)
  9 Online Courses |  10 Hands-on Projects |  123+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Data Visualization Training (15 Courses, 5+ Projects)4.9
Business Intelligence Training (12 Courses, 6+ Projects)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more