| Transforming Data with SAS Functions | |
| Understanding SAS
Functions |
|
| SAS functions are built-in expressions that enable you to complete many types of data manipulations quickly and easily. Generally speaking, functions provide programming shortcuts. There are a wide variety of SAS functions: mathematical functions, financial functions, character functions, probability functions, and many more. |
| Categories of SAS Functions | |
|---|---|
| Array | Probability |
| Bitwise Logical Operations | Quantile |
| Character | Random Number |
| Character String Matching | Sample Statistics |
| Date and Time | SAS File I/O |
| Dynamic Link Library | Special |
| External Files | State and ZIP Code |
| Financial | Trigonometric |
| Hyperbolic | Truncation |
| Macro | Variable Control |
| Mathematical | Variable Information |
| MultiByte Character Set | |
| Uses of SAS Functions
Using SAS functions, you can
This lesson concentrates on functions that
However, be sure to explore the many other SAS functions. Refer to SAS Language Reference: Dictionary for more information. |
| Example of a SAS Function
SAS functions can be used in DATA step programming statements and in some statistical procedures. A SAS function can be specified anywhere that you would use a SAS expression, as long as the function is part of a SAS statement.
Let's look at a simple example of a SAS function. The assignment statement
below uses the MEAN function to calculate the average of three exam scores,
stored in the variables AvgScore=mean(exam1,exam2,exam3);
When you reference a SAS function, the function returns a value based on
the function arguments. The MEAN function above contains three arguments,
the variables Some functions require a specific number of arguments, while other functions may contain any number of arguments. Some functions require no arguments. |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.