
SAS FUNCTIONS
SAS functions are utilized to manipulate and transform data, perform statistical calculations, explore data quality, and create new variables. They provide a convenient way to extract specific information, convert data types, and reformat values.
SAS functions also assist in aggregating data, calculating summary statistics, and conducting statistical analysis. They play a crucial role in data exploration, identifying missing values, and converting character variables. Additionally, SAS functions enable the application of conditional logic, allowing for the creation of derived variables and data transformation.
What are SAS functions
SAS functions are pre-defined routines in SAS programming that perform specific operations on data. They can manipulate and transform data, calculate summary statistics, and generate derived variables. SAS functions provide various capabilities, including extracting specific information from variables, converting data types, and performing mathematical operations. They are essential for data manipulation, exploration, and analysis in SAS programming. SAS functions simplify complex calculations and enable efficient data processing, ultimately aiding decision-making and generating valuable insights. The SAS System provides an extensive library of built-in functions.
Syntax of function
New_Var = Funtion_Name (Req_argument1 .., Opt_argument1 ....N);
Features of SAS functions
A SAS statement identifies a function using its name, function argument(s), and parentheses around the function arguments.
SAS functions are designed to optimize data processing. They are typically implemented in a way that allows SAS to execute them efficiently, even when working with large datasets.
SAS functions have a consistent syntax, which makes them easier to learn and use. They typically follow the format function_name(argument1, argument2, ...), where you provide the necessary arguments within the parentheses.
SAS functions seamlessly integrate with other SAS components, such as procedures, formats, and macros.
SAS functions cover a wide array of statistical analyses. You can use functions for hypothesis testing, regression analysis, probability distributions, etc.
SAS functions are designed for efficiency, making them suitable for processing large datasets.
SAS functions for character data allow you to manipulate strings, concatenate, trim, extract substrings, and perform pattern matching and replacement.
The arguments for any given function can be
♦ Variables---Y = ABS(Var_Name) ;
♦ Constants---X = SQRT(9562) ;
♦ Expressions---- Z = MAX(Pre-Post) ;
♦ Functions ---Q = Left(Trim(Str));
Arithmetic Functions
Arithmetic functions in SAS are built-in tools that perform mathematical operations on numeric values. These functions enable you to conduct calculations, manipulate data, and derive insights from numerical data within SAS programs. Examples of arithmetic functions include SUM (to find the sum of values), MEAN (to calculate the average), MIN (to identify the minimum value), MAX (to find the maximum value), and more. These functions are essential for SAS's data analysis, statistical modeling, and data transformation tasks.
ABS Function
The ABS function is called absolute value because it returns the magnitude or size of a number without considering its direction or sign. It gives the distance of the number from zero on a number line, which is always a positive value. Therefore, it provides an absolute or definite value of a number, regardless of whether it is positive or negative.
Data _NULL_;
FILE ‘E:\nulrpt.txt’;
Val= -17;
Abs_Val = ABS (Val);
PUT Abs_Val =;
Run;
According to the clinical studies, Patient visits are organized according to Protocol. In study X, Visits are planned on Day 1, Day 30, Day 60, and Day 120 for Visit 3, Visit 4, Visit 5, and Visit 6, respectively (As per Protocol). A day window period is permitted for patients.
DATA _NULL_: The Data set name _NULL_ is a unique keyword. The workspace does not store the _NULL_ Data set. The keyword deactivates the standard automatic output generated after the Data step. Writing output to reports or files is its usual use.
FILE statement: The FILE statement in SAS is used to specify the location and properties of an external file that you want to read from or write to within a SAS program. It allows you to define the file's name, location, access mode (e.g., reading or writing), and other attributes. The FILE statement is commonly used in DATA steps and with various SAS procedures to import data from external files, export data to external files, or manipulate data stored in external files. It plays a crucial role in data integration and exchange between SAS and other data sources, such as text files, spreadsheets, or databases.
PUT statement: The PUT statement in SAS is used to write data or text to an external file or the SAS log. It allows you to format and output data from a SAS program, creating customized reports or exporting data in a specific format. The PUT statement helps generate structured text files, create data extracts, and produce user-friendly output in the SAS log for debugging and documentation purposes.
MOD Function
The MOD function is a mathematical operation that calculates the remainder when one number is divided by another. It is commonly used in computer programming and data analysis to determine cyclic patterns or group data into specific intervals.
Syntax: New_Var=MOD (Argument1, Argument2);
Argument-1: is a numeric constant, variable, or expression that specifies the dividend.
Argument-2: is a numeric constant, variable, or expression that specifies the divisor.
Data Test;
Val= MOD (22, 4);
Run;
We created a Test dataset with a variable VAL by executing the above step. The data value of this variable is 2, which is the remainder of the division.
SAS functions are robust tools in the SAS programming language that enable data manipulation, transformation, and analysis. With many functions available, SAS users can perform complex calculations, handle missing values, format data, extract information, and more. These functions enhance the functionality and efficiency of SAS programs, allowing users to process and analyze data for various applications effectively.
Find a course provider to learn SAS
Java training | J2EE training | J2EE Jboss training | Apache JMeter trainingTake the next step towards your professional goals in SAS
Don't hesitate to talk with our course advisor right now
Receive a call
Contact NowMake a call
+1-732-338-7323Enroll for the next batch
SAS Certification Course
- Dec 15 2025
- Online
SAS Certification Course
- Dec 16 2025
- Online
SAS Certification Course
- Dec 17 2025
- Online
SAS Course Online Training
- Dec 18 2025
- Online
SAS Course Online Training
- Dec 19 2025
- Online
Related blogs on SAS to learn more

SAS Character Functions Demystified: A Comprehensive Guide
Master the power of SAS character functions and learn how to streamline your data processing tasks.

A Comprehensive Guide on Character Functions of SAS
Now we shall discuss a Comprehensive Guide on Character Functions of SAS in detail.

From Data to Graphs: Harnessing SAS/GRAPH for Effective Analysis
Learn how to effectively analyze and present your data with this comprehensive guide to SAS/GRAPH.

Introduction to SAS/Library
In this blog, we shall discuss introduction to SAS and its library in detail

Importing Data into a SAS Data Set: Effective Methods and Techniques
we have discussed how to import data into SAS data set, best practices for data reading in SAS, and how to create a dataset

INTRODUCTION TO SAS
We have discussed What is SAS, variables in SAS, six attributes of SAS stores and many other unique concepts of SAS.

SAS to help British Forces to hunt down Nazi Criminals!
As the SAS empowers the professionals to accomplish various success, it has also revealed it’s to open the secrets and postwar exploits helping the government to hunt down the Nazi crime people.

SAS Factory Miner will take your business analysis to next level!
SAS gained significant reach across the globe by providing a reliable platform for advanced statistical analytics. As the more and more organizations grow their need to acquire analytical software, SAS skills

Welcome SAS Factory Miner which takes your business analysis to next level!
SAS gained significant reach across the globe by providing a reliable platform for advanced statistical analytics. As the more and more organizations grow their need to acquire analytical software, SAS

SAS unveils Viya, destined to be the foundation of future products
The ability to analyze, manage and modify data from multiple types of sources makes SAS an unique and popular data analytic software suite in the world. The software suite already become friendly with the non-technical users with its GUI (Graphical U
Latest blogs on technology to explore

From Student to AI Pro: What Does Prompt Engineering Entail and How Do You Start?
Explore the growing field of prompt engineering, a vital skill for AI enthusiasts. Learn how to craft optimized prompts for tools like ChatGPT and Gemini, and discover the career opportunities and skills needed to succeed in this fast-evolving indust

How Security Classification Guides Strengthen Data Protection in Modern Cybersecurity
A Security Classification Guide (SCG) defines data protection standards, ensuring sensitive information is handled securely across all levels. By outlining confidentiality, access controls, and declassification procedures, SCGs strengthen cybersecuri

Artificial Intelligence – A Growing Field of Study for Modern Learners
Artificial Intelligence is becoming a top study choice due to high job demand and future scope. This blog explains key subjects, career opportunities, and a simple AI study roadmap to help beginners start learning and build a strong career in the AI

Java in 2026: Why This ‘Old’ Language Is Still Your Golden Ticket to a Tech Career (And Where to Learn It!
Think Java is old news? Think again! 90% of Fortune 500 companies (yes, including Google, Amazon, and Netflix) run on Java (Oracle, 2025). From Android apps to banking systems, Java is the backbone of tech—and Sulekha IT Services is your fast track t

From Student to AI Pro: What Does Prompt Engineering Entail and How Do You Start?
Learn what prompt engineering is, why it matters, and how students and professionals can start mastering AI tools like ChatGPT, Gemini, and Copilot.

Cyber Security in 2025: The Golden Ticket to a Future-Proof Career
Cyber security jobs are growing 35% faster than any other tech field (U.S. Bureau of Labor Statistics, 2024)—and the average salary is $100,000+ per year! In a world where data breaches cost businesses $4.45 million on average (IBM, 2024), cyber secu

SAP SD in 2025: Your Ticket to a High-Flying IT Career
In the fast-paced world of IT and enterprise software, SAP SD (Sales and Distribution) is the secret sauce that keeps businesses running smoothly. Whether it’s managing customer orders, pricing, shipping, or billing, SAP SD is the backbone of sales o

SAP FICO in 2025: Salary, Jobs & How to Get Certified
AP FICO professionals earn $90,000–$130,000/year in the USA and Canada—and demand is skyrocketing! If you’re eyeing a future-proof IT career, SAP FICO (Financial Accounting & Controlling) is your golden ticket. But where do you start? Sulekha IT Serv

Train Like an AI Engineer: The Smartest Career Move You’ll Make This Year!
Why AI Engineering Is the Hottest Skillset Right Now From self-driving cars to chatbots that sound eerily human, Artificial Intelligence is no longer science fiction — it’s the backbone of modern tech. And guess what? Companies across the USA and Can

Confidence Intervals & Hypothesis Tests: The Data Science Path to Generalization
Learn how confidence intervals and hypothesis tests turn sample data into reliable population insights in data science. Understand CLT, p-values, and significance to generalize results, quantify uncertainty, and make evidence-based decisions.