SAS Functions Overview and Usage
In this module, you will delve into various SAS functions covering numerical, date, and character functions. Explore functions like DATE, DAY, ROUND, and FLOOR, and learn how to effectively utilize them in your SAS programming endeavors. Enhance your proficiency in SAS functions with detailed syntax, arguments, examples, and essential concepts presented by Dr. Mark Carpenter.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Introduction to SAS Programming and Applications Thursday, Sep 24, 2015 MARK CARPENTER, Ph.D. Module 5 : SAS Functions Description. In this module, we with various SAS Functions, including numerical functions, date functions and character functions. SAS Keywords : Date, Day, Year, Month, COMPBL, COMPRESS, FIND New Topics : Character and Date Functions New PROCs : N/A http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a0002458 60.htm
Introduction to SAS Programming and Applications DATE/TIME FUNCTIONS: DATE Function DATE Function Returns the current date as a SAS date value. Category: Date and Time Alias: TODAY See: TODAY Function http://support.sas.com/documentation/cdl/ en/lrdict/64316/HTML/default/viewer.htm #a000200621.htm Syntax Syntax DATE() Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications DATE/TIME FUNCTIONS: DAY Function DAY Function Returns the day of the month from a SAS date value. Category: Date and Time Syntax Arguments Details Examples See Also Syntax DAY(date) http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a000201606 .htm Arguments date specifies a SAS expression that represents a SAS date value. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications TRUNCATION FUNCTIONS: ROUND Function ROUND Function Rounds the first argument to the nearest multiple of the second argument, or to the nearest integer when the second argument is omitted. Category: Truncation http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a000245942 .htm Syntax Arguments Details Basic Concepts Differences between Binary and Decimal Arithmetic The Effects of Rounding Expressing Binary Values Testing for Approximate Equality Producing Expected Results When the Rounding Unit Is the Reciprocal of an Integer Computing Results in Special Cases Computing Results When the Value Is Halfway between Multiples of the Rounding Unit Syntax ROUND (argument <,rounding-unit>) Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications TRUNCATION FUNCTIONS: FLOOR Function FLOOR Function Returns the largest integer that is less than or equal to the argument, fuzzed to avoid unexpected floating-point results. Category: Truncation Syntax FLOOR (argument) http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a000207955 .htm Arguments argument specifies a numeric constant, variable, or expression. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: COMPBL Function COMPBL Function Removes multiple blanks from a character string. Category: Character Syntax COMPBL(source) http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a000214211 .htm Arguments source specifies a character constant, variable, or expression to compress. The Basics: The COMPBL function removes multiple blanks in a character string by translating each occurrence of two or more consecutive blanks into a single blank. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: COMPRESS Function http://support.sas.com/documentation/cdl/en/lrd ict/64316/HTML/default/viewer.htm#a000212246 .htm COMPRESS Function Returns a character string with specified characters removed from the original string. Category: Character Restriction: I18N Level 0 Tip: DBCS equivalent function is KCOMPRESS in SAS National Language Support (NLS): Reference Guide. Syntax COMPRESS(<source><, chars><, modifiers>) Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications running head CHARACTER FUNCTIONS: FINDFunction FIND Function: Searches for a specific substring of characters within a character string. Category: Character Syntax FIND(string,substring<,modifiers><,startpos>) FIND(string,substring<,startpos><,modifiers>) http://support.sas.com/documentation/cdl/en /lrdict/64316/HTML/default/viewer.htm#a002 267763.htm Arguments string specifies a character constant, variable, or expression that will be searched for substrings substring is a character constant, variable, or expression that specifies the substring of characters to search for in string. modifiers is a character constant, variable, or expression that specifies one or more modifiers. The following modifiers can be in uppercase or lowercase: Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1
Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: SUBSTRFunction SUBSTR (left of =) Function Replaces character value contents. Category: Character Syntax SUBSTR(variable, position<,length>)=characters-to-replace http://support.sas.com/documentation/cdl/en /lrdict/64316/HTML/default/viewer.htm#a000 212267.htm Arguments Variable: specifies a character variable. Position: specifies a numeric constant, variable, or expression that is the beginning character position. Length: specifies a numeric constant, variable, or expression that is the length of the substring that will be replaced. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1