Presentation is loading. Please wait.

Presentation is loading. Please wait.

MARK CARPENTER, Ph.D. Introduction to SAS Programming and Applications

Similar presentations


Presentation on theme: "MARK CARPENTER, Ph.D. Introduction to SAS Programming and Applications"— Presentation transcript:

1 MARK CARPENTER, Ph.D. 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

2 Returns the current date as a SAS date value. Category: Date and Time
DATE Function Returns the current date as a SAS date value. Category: Date and Time Alias: TODAY See: TODAY Function Syntax DATE() Introduction to SAS Programming and Applications DATE/TIME FUNCTIONS: DATE Function Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1

3 DATE/TIME FUNCTIONS: DAY Function
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 DAY(date) date specifies a SAS expression that represents a SAS date value. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1

4 TRUNCATION FUNCTIONS: 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 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 ROUND (argument <,rounding-unit>) Introduction to SAS Programming and Applications TRUNCATION FUNCTIONS: ROUND Function Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1

5 TRUNCATION FUNCTIONS: FLOOR Function
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) Arguments argument specifies a numeric constant, variable, or expression. Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1

6 CHARACTER FUNCTIONS: COMPBL Function
Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: COMPBL Function COMPBL Function Removes multiple blanks from a character string. Category: Character Syntax COMPBL(source) 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

7 CHARACTER FUNCTIONS: COMPRESS Function
Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: COMPRESS Function 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

8 CHARACTER FUNCTIONS: FINDFunction
running head 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>) 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: Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: FINDFunction Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1

9 CHARACTER FUNCTIONS: SUBSTRFunction
SUBSTR (left of =) Function Replaces character value contents. Category: Character Syntax SUBSTR(variable, position<,length>)=characters-to-replace 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. Introduction to SAS Programming and Applications CHARACTER FUNCTIONS: SUBSTRFunction Module 5 : SAS Functions Mark Carpenter, Ph.D. Slide 3-1


Download ppt "MARK CARPENTER, Ph.D. Introduction to SAS Programming and Applications"

Similar presentations


Ads by Google