![]() Chapter Contents |
![]() Previous |
![]() Next |
Understanding the Language |
The general form of a function is
matrix inquiry functions | |
return information about a matrix. For example, the ANY function returns a value of 1 if any of the elements of the argument matrix are nonzero. | |
scalar functions | |
operate on each element of the matrix argument. For example, the ABS function returns a matrix with elements that are the absolute values of the corresponding elements of the argument matrix. | |
summary functions | |
return summary statistics based on all elements of the matrix argument. For example, the SSQ function returns the sum of squares of all elements of the argument matrix. | |
matrix arithmetic functions | |
perform matrix algebraic operations on the argument. For example, the TRACE function returns the trace of the argument matrix. |
matrix reshaping functions | |
manipulate the matrix argument and return a reshaped matrix. For example, the DIAG function returns a matrix with diagonal elements that are equal to the diagonal elements of a square argument matrix. All off-diagonal elements are zero. | |
linear algebra and statistical functions | |
perform linear algebraic functions on the matrix argument. For example, the GINV function returns the matrix that is the generalized inverse of the argument matrix. |
DIFn | HBOUND | LAGn | PUT | |||
DIM | INPUT | LBOUND |
MAX | RANK | SOUND | SUBSTR | |||
MIN | REPEAT | SSQ | SUM |
The random number functions, UNIFORM and NORMAL, are built-in and produce the same streams as the RANUNI and RANNOR functions, respectively, of the DATA step. For example, to create a 10 ×1 vector of random numbers, use
x=uniform(repeat(0,10,1));Also, SAS/IML software does not support the OF clause of the SAS DATA step. For example, the statement
a=mean(of x1-x10); /* invalid in IML */cannot be interpreted properly in IML. The term (X1-X10) would be interpreted as subtraction of the two matrix arguments rather than its DATA step meaning, "X1 through X10."
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.