
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
- Jun 9 2025
- Online
SAS Certification Course
- Jun 10 2025
- Online
SAS Certification Course
- Jun 11 2025
- Online
SAS Course Online Training
- Jun 12 2025
- Online
SAS Course Online Training
- Jun 13 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

What Does a Cybersecurity Analyst Do? 2025
Discover the vital role of a Cybersecurity Analyst in 2025, protecting organizations from evolving cyber threats through monitoring, threat assessment, and incident response. Learn about career paths, key skills, certifications, and why now is the be

Artificial intelligence in healthcare: Medical and Diagnosis field
Artificial intelligence in healthcare: Medical and Diagnosis field

iOS 18.5 Is Here: 7 Reasons You Should Update Right Now
In this blog, we shall discuss Apple releases iOS 18.5 with new features and bug fixes

iOS 18.4.1 Update: Why Now is the Perfect Time to Master iPhone App Development
Discover how Apple’s iOS 18.4.1 update (April 2025) enhances security and stability—and why mastering iPhone app development now is key to building future-ready apps.

What is network security Monitoring? A complete guide
In the digital world, we have been using the cloud to store our confidential data to register our details; it can be forms, applications, or product purchasing platforms like e-commerce sites. Though digital platforms have various advantages, one pri

How to Handle Complex and Challenging Projects with Management Skills
Discover actionable strategies and essential management skills to effectively navigate the intricacies of challenging projects. From strategic planning to adaptive problem-solving, learn how to lead your team and achieve exceptional outcomes in compl

What are the 5 phases of project management?
A streamlined approach to ensure project success by breaking it into five essential stages: Initiation, Planning, Execution, Monitoring & Controlling, and Closing. Each phase builds on the other, guiding the team from concept to completion with clear

About Microsoft Job Openings and Certification Pathway to Explore Job Vacancies
Explore exciting Microsoft job openings across the USA in fields like software engineering, data science, cybersecurity, and more. Enhance your career with specialized certifications and land top roles at Microsoft with Sulekha's expert courses.