The SAS programming language is extensive and flexible, and there are many features of the language that were not discussed in the previous chapters of this book. The next two chapters are included for those who want to go deeper into SAS programming. This chapter introduces several topics that are commonly used in preparing data for analysis not covered in previous chapters. Additional programming topics including arrays and macros are covered in Chapter 7.

6.1 USING SAS FUNCTIONS

Sophisticated calculations can be created using SAS functions. These functions include arithmetic and text and date manipulation. The format for the use of SAS functions is

variable = function(argument1,argument2, etc.);

Functions can require one or more arguments. Some require no arguments.

For example, a few mathematical functions in SAS are as follows:

S = ABS(X);

Absolute value

S = FACT(X);

Factorial

S = INT(X);

Integer portion of a value

S = LOG(X);

Natural log

S = SQRT(X);

Square root

Some of the other functions available in SAS are SUBSTR, LAG, COS, SIN, ARCS, LOG10, UNIFORM, NORMAL, SUM, and MEAN. A list of commonly used SAS functions and additional examples can be found in Appendix B. These include functions of these types: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.