Você está na página 1de 5

Definition of Functions

A SAS function performs a computation or system manipulation on arguments (inputs) and returns a value. Most functions use arguments supplied by the user, but a few obtain their arguments from the operating environment.

The syntax of a function is function-name (argument-1<, ...argument-n>) function-name (OF variable-list) function-name (OF array-name{*})
z=sum(of y1-y10); a=sum(of x y z); array y{10} y1-y10; x=sum(of y{*});

SAS Functions by Category


Character/String Functions:

CAT Function COMPBL Function COMPRESS Function

INDEX Function
LEFT Function LENGTH Function LOWCASE Function PROPCASE Function RIGHT Function

SCAN Function SUBSTR Fuction


TRANSLATE Function TRIM Function UPCASE Function

Date and Time DATE Function DATEPART Function Returns the current date as a SAS date value Extracts the date from a SAS datetime value

DATETIME Function DAY Function HOUR Function INTCK Function

Returns the current date and time of day as a SAS datetime value Returns the day of the month from a SAS date value Returns the hour from a SAS time or datetime value Returns the integer count of the number of interval boundaries between two dates, two times, or two datetime values Increments a date, time, or datetime value by a given interval or intervals, and returns a date, time, or datetime value Returns a SAS date value from month, day, and year values Returns the minute from a SAS time or datetime value Returns the month from a SAS date value Returns the quarter of the year from a SAS date value Returns the second from a SAS time or datetime value Returns the current time of day Extracts a time value from a SAS datetime value Returns the current date as a SAS date value Returns the week number value Returns the day of the week from a SAS date value Returns the year from a SAS date value

INTNX Function

MDY Function MINUTE Function MONTH Function QTR Function SECOND Function TIME Function TIMEPART Function TODAY Function WEEK Function WEEKDAY Function YEAR Function

Descriptive Statistics MAX Function

Returns the largest value Returns the arithmetic mean (average) Computes median values Returns the smallest value Returns the standard deviation
Returns the sum of the nonmissing arguments

MEAN Function MEDIAN Function MIN Function


STD Function SUM Function

Mathematical

ABS Function EXP Function FACT Function LOG Function

Returns the absolute value Returns the value of the exponential function Computes a factorial Returns the natural (base e) logarithm

MOD Function

Returns the remainder from the division of the first argument by the second argument, fuzzed to avoid most unexpected floating-point results Returns the square root of a value

SQRT Function

CEIL Function

Returns the smallest integer that is greater than or equal to the argument, fuzzed to avoid unexpected floating-point results Returns the largest integer that is less than or equal to the argument, fuzzed to avoid unexpected floating-point results Returns the integer value, fuzzed to avoid unexpected floating-point results Rounds the first argument to the nearest multiple of the second argument, or to the nearest integer when the second argument is omitted Returns the value produced when a SAS expression that uses a specified informat expression is read Returns a value using a specified format

FLOOR Function INT Function ROUND Function

INPUT Function PUT Function