SAS 9.1.3 Language Reference: Concepts, Third Edition, Volumes 1 and 2

SAS Variables in Expressions

Definition

variable

   

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" on page 123 for an example of the PUT function. See SAS Language Reference: Dictionary for more details on these functions.

For more information on SAS variables, see Chapter 5, "SAS Variables," on page 77 or the SAS Language Reference: Dictionary .

Категории