Transforming Data with SAS Functions | |
General Form of SAS
Functions |
Arguments, Variable Lists, Arrays
All SAS functions are written by specifying the function name followed by the function arguments, enclosed in parentheses. |
General form, SAS function:
where
|
When a function contains more than one argument, the arguments are usually
separated by commas. function-name(argument-1,argument-2,argument-n) However, for some functions, variable lists and arrays can also be used as arguments, as long as the list or the array is preceded by the word OF. You can learn about arrays in the lesson Processing Variables with Arrays.
Here is an example of a function that contains multiple arguments. Notice that the arguments are separated by commas. mean(x1,x2,x3) The arguments for this function can also be written as a variable list. mean(of x1-x3) Or the variables can be referenced by an array. mean(of newarray {*})
When specifying function arguments with a variable list or an array, be sure
to precede the list or the array with the word OF. If you omit the word OF,
the function arguments may not be interpreted as expected. For example, the
function below calculates the average of mean(x1-x3) |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.