SAS Functions
SAS Functions
Arithmetic Functions
ABS(argument) DIM<n>(array-name) returns absolute value 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<n>(array-name) HBOUND(arrayname,bound-n) LBOUND<n>(array-name) LBOUND(arrayname,bound-n) returns the upper bound of an array returns the upper bound of an array returns the lower bound of an array 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) SIGN(argument) SQRT(argument) returns the remainder returns the sign of a value or 0 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 returns an ASCII or EBCDIC collating sequence character string removes multiple blanks between words in a COLLATE(start-position<,end-position>) | (startposition<,,length>) COMPBL(source)
character string COMPRESS(source<,characters-to-remove>) DEQUOTE(argument) INDEX(source,excerpt) INDEXC(source,excerpt-1<, ... excerpt-n>) INDEXW(source,excerpt) LEFT(argument) LENGTH(argument) LOWCASE(argument) QUOTE(argument) RANK(x) REPEAT(argument,n) REVERSE(argument) RIGHT(argument) SCAN(argument,n<,delimiters>) SOUNDEX(argument) SUBSTR(argument,position<,n>)=characters-toreplace var=SUBSTR(argument,position<,n>) TRANSLATE(source,to-1,from-1<,...to-n,from-n>) TRANWRD(source,target,replacement) TRIM(argument) TRIMN(argument) UPCASE(argument) VERIFY(source,excerpt-1<,...excerpt-n) removes specific characters from a character string removes quotation marks from a character value searches the source for the character string specified by the excerpt searches the source for any character present in the excerpt searches the source for a specified pattern as a word left-aligns a SAS character string returns the length of an argument converts all letters in an argument to lowercase adds double quotation marks to a character value returns the position of a character in the ASCII or EBCDIC collating sequence repeats a character expression reverses a character expression right-aligns a character expression returns a given word from a character expression encodes a string to facilitate searching replaces character value contents extracts a substring from an argument. (var is any valid SAS variable name.) replaces specific characters in a character expression replaces or removes all occurrences of a word in a character string removes trailing blanks from character expression and returns one blank if the expression is missing removes trailing blanks from character expressions and returns a null string if the expression is missing converts all letters in an argument to uppercase returns the position of the first character unique to an expression
DATE() DATEJUL(julian-date) DATEPART(datetime) DATETIME() DAY(date) DHMS(date,hour,minute,second) HMS(hour,minute,second) HOUR(<time | datetime>) INTCK('interval',from,to) INTNX('interval',startfrom,increment<,'alignment'>) JULDATE(date) MDY(month,day,year) MINUTE(time | datetime) MONTH(date) QTR(date) SECOND(time | datetime) TIME() TIMEPART(datetime) TODAY() WEEKDAY(date) YEAR(date) YRDIF(sdate,edate,basis) YYQ(year,quarter)
returns the current date as a SAS date value converts a Julian date to a SAS date value extracts the date from a SAS datetime value returns the current date and time of day returns the day of the month from a SAS date value returns a SAS datetime value from date, hour, minute, and second returns a SAS time value from hour, minute, and second returns the hour from a SAS time or datetime value returns the number of time intervals in a given time span advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value returns the Julian date from a SAS date 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 day of the week from a SAS date value returns the year from a SAS date value returns the difference in years between two dates returns a SAS date value from the year and quarter
Mathematical Functions
AIRY(x) DAIRY(x) DIGAMMA(argument) ERF(argument) ERFC(argument) EXP(argument) GAMMA(argument) returns the value of the AIRY function returns the derivative of the AIRY function returns the value of the DIGAMMA function returns the value of the (normal) error function returns the value of the (normal) error function returns the value of the exponential function returns the value of the GAMMA function
returns the value of the modified bessel function returns the value of the bessel function returns the natural logarithm of the GAMMA function returns the natural (base e) logarithm returns the logarithm to the base 2 returns the logarithm to the base 10 returns the value of the TRIGAMMA function
Noncentrality Functions
CNONCT(x,df,prob) returns the noncentrality parameter from a chi-squared distribution FNONCT(x,ndf,ddf,prob) returns the value of the noncentrality parameter of an F distribution TNONCT(x,df,prob) returns the value of the noncentrality parameter from the student's t distribution
distribution PROBT(x,df<,nc>) SDF('dist',quantile,parm-1,...,parm-k) returns the probability from a Student's t distribution computes a survival function
Quantile Functions
BETAINV(p,a,b) CINV(p,df<,nc>) FINV(p,ndf,ddf<,nc> ) GAMINV(p,a) PROBIT(p) TINV(p,df<,nc>) returns a quantile from the beta distribution returns a quantile from the chi-squared distribution returns a quantile from the F distribution returns a quantile from the gamma distribution returns a quantile from the standard normal distribution returns a quantile from the t distribution
STNAMEL(postalcode)
Truncation Functions
CEIL(argument) FLOOR(argument) returns the smallest integer that is greater than or equal to the argument returns the largest integer that is less than or equal to the argument
returns the nearest integer if the argument is within 1E-12 returns the integer value rounds to the nearest round-off unit truncates a numeric value to a specified length
VARNUM(data-set-id,var-name) returns the number of a SAS data set variable's position in a SAS data set VARRAY(name) VARRAYX(expression) VARTYPE(data-set-id,var-num) VFORMAT(var) VFORMATD(var) VFORMATDX(expression) VFORMATN(var) VFORMATNX(expression) VFORMATW(var) VFORMATWX(expression) VFORMATX(expression) VINARRAY(var) VINARRAYX(expression) returns a value that indicates whether the specified name is an array returns a value that indicates whether the value of the specified argument is an array returns the data type of a SAS data set variable returns the format associated with the given variable returns the format decimal value associated with the given variable returns the format decimal value associated with the value of the specified argument returns the format name associated with the given variable returns the format name associated with the value of the specified argument returns the format width associated with the given variable returns the format width associated with the value of the specified argument returns the format associated with the value of the specified argument returns a value that indicates whether the given variable is a member of an array returns a value that indicates whether the value of the specified
argument is a member of an array VINFORMAT(var) VINFORMATD(var) VINFORMATDX(expression) VINFORMATN(var) VINFORMATNX(expression) VINFORMATW(var) VINFORMATWX(expression) VINFORMATX(expression) VLABEL(var) VLABELX(expression) VLENGTH(var) VLENGTHX(expression) VNAME(var) VNAMEX(expression) VTYPE(var) VTYPEX(expression) returns the informat associated with the given variable returns the informat decimal value associated with the given variable returns the informat decimal value associated with the value of the specified argument returns the informat name associated with the given variable returns the informat name associated with the value of the specified argument returns the informat width associated with the given variable returns the informat width associated with the value of the specified argument returns the informat associated with the value of the specified argument returns the label associated with the given variable returns the variable label for the value of a specified argument returns the compile-time (allocated) size of the given variable returns the compile-time (allocated) size for the value of the specified argument returns the name of the given variable validates the value of the specified argument as a variable name returns the type (character or numeric) of the given variable returns the type (character or numeric) for the value of the specified argument