Previous Page | Next Page

Working with Numeric Variables

Review of SAS Tools


Functions

ROUND (expression, round-off-unit)

rounds the quantity in expression to the figure given in round-off-unit. The expression can be a numeric variable name, a numeric constant, or an arithmetic expression. Separate round-off-unit from expression with a comma.

SUM (expression-1<, . . . expression-n>)

produces the sum of all expressions that you specify in the parentheses. The SUM function ignores missing values as it calculates the sum of the expressions. Each expression can be a numeric variable, a numeric constant, another arithmetic expression, or another numeric function.


Statements

LENGTH variable-list number-of-bytes;

indicates that the variables in the variable-list are to be stored in the data set according to the number-of-bytes that you specify. Numeric variables are not affected while they are in the program data vector. The default length for a numeric variable is 8 bytes. In general, the minimum you should use is 4 bytes for variables that contain integers and 8 bytes for variables that contain fractions. You can assign lengths to both numeric and character variables (discussed in the next section) in a single LENGTH statement.

variable=expression;

is an assignment statement. It causes SAS to calculate the value of the expression on the right side of the equal sign and assign the result to the variable on the left. When variable is numeric, the expression can be an arithmetic calculation, a numeric constant, or a numeric function.

Previous Page | Next Page | Top of Page