Previous Page | Next Page


SAS Variables in Expressions



is a set of data values that describe a given characteristic. A variable can be used in an expression.

Automatic Numeric-Character Conversion

If you specify a variable in an expression, but the variable value does not match the type called for, SAS attempts to convert the value to the expected type. SAS automatically converts character variables to numeric variables and numeric variables to character variables, according to the following rules:

When SAS performs an automatic conversion, it prints a note in the SAS log informing you that the conversion took place. If converting a character variable to numeric produces invalid numeric values, SAS assigns a missing value to the result, prints an error message in the log, and sets the value of the automatic variable _ERROR_ to 1.

Note:   You can also use the PUT and INPUT functions to convert data values. These functions can be more efficient than automatic conversion. See The Concatenation Operator for an example of the PUT function. See SAS Language Reference: Dictionary for more details on these functions.  [cautionend]

For more information on SAS variables, see SAS Variables or SAS Language Reference: Dictionary.

Previous Page | Next Page | Top of Page