Wednesday, January 9, 2008

SAS Functions (an excerpt)

SAS FUNCTIONS
Arithmetic Functions
ABS(argument)
returns absolute value
DIM(array-name)
returns the number of elements in a one-dimensional array or the number of elements in a specified dimension of a multidimensional array.
n specifies the dimension, in a multidimensional array, for which you want to know the the number of elements.
DIM(array-name,bound-n)
returns the number of elements in a one-dimensional array or the number of elements in the specified dimension of a multidimensional array
bound-n specifies the dimension in a multidimensional array, for which you want to know the number of elements.
HBOUND(array-name)
returns the upper bound of an array
HBOUND(array-name,bound-n)
returns the upper bound of an array
LBOUND(array-name)
returns the lower bound of an array
LBOUND(array-name,bound-n)
returns the lower bound of an array
MAX(argument,argument, ...)
returns the largest value of the numeric arguments
MIN(argument,argument, ...)
returns the smallest value of the numeric arguments
MOD(argument-1, argument-2)
returns the remainder
SIGN(argument)
returns the sign of a value or 0
SQRT(argument)
returns the square root

Character Functions
BYTE(n)
returns one character in the ASCII or EBCDIC collating sequence where nis an integer representing a specific ASCII or EBCDIC character
COLLATE(start-position<,end-position>) (start-position<,,length>)
returns an ASCII or EBCDIC collating sequence character string
COMPBL(source)
removes multiple blanks between words in a character string
COMPRESS(source<,characters-to-remove>)
removes specific characters from a character string
DEQUOTE(argument)
removes quotation marks from a character value
INDEX(source,excerpt)
searches the source for the character string specified by the excerpt
INDEXC(source,excerpt-1<, ... excerpt-n>)
searches the source for any character present in the excerpt
INDEXW(source,excerpt)
searches the source for a specified pattern as a word
LEFT(argument)
left-aligns a SAS character string
LENGTH(argument)
returns the length of an argument
LOWCASE(argument)
converts all letters in an argument to lowercase
QUOTE(argument)
adds double quotation marks to a character value
RANK(x)
returns the position of a character in the ASCII or EBCDIC collating sequence
REPEAT(argument,n)
repeats a character expression
REVERSE(argument)
reverses a character expression
RIGHT(argument)
right-aligns a character expression
SCAN(argument,n<,delimiters>)
returns a given word from a character expression
SOUNDEX(argument)
encodes a string to facilitate searching
SUBSTR(argument,position<,n>)=characters-to-replace
replaces character value contents
var=SUBSTR(argument,position<,n>)
extracts a substring from an argument. (var is any valid SAS variable name.)
TRANSLATE(source,to-1,from-1<,...to-n,from-n>)
replaces specific characters in a character expression
TRANWRD(source,target,replacement)
replaces or removes all occurrences of a word in a character string
TRIM(argument)
removes trailing blanks from character expression and returns one blank if the expression is missing
TRIMN(argument)
removes trailing blanks from character expressions and returns a null string if the expression is missing
UPCASE(argument)
converts all letters in an argument to uppercase
VERIFY(source,excerpt-1<,...excerpt-n)
returns the position of the first character unique to an expression

Date and Time Functions
DATDIF(sdate,edate,basis)
returns the number of days between two dates
DATE()
returns the current date as a SAS date value
DATEJUL(julian-date)
converts a Julian date to a SAS date value
DATEPART(datetime)
extracts the date from a SAS datetime value
DATETIME()
returns the current date and time of day
DAY(date)
returns the day of the month from a SAS date value
DHMS(date,hour,minute,second)
returns a SAS datetime value from date, hour, minute, and second
HMS(hour,minute,second)
returns a SAS time value from hour, minute, and second
HOUR(

No comments: