VVALUE Function

Returns the formatted value that is associated with the variable that you specify.

Category: Variable Information
Restriction: Use only with the DATA step

Syntax

VVALUE(var)

Required Argument

var

specifies a variable that is expressed as a scalar or as an array reference.

Restriction You cannot use an expression as an argument.

Details

If the VVALUE function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 200.
VVALUE returns a character string that contains the current value of the variable that you specify. The value is formatted using the current format that is associated with the variable.

Comparisons

  • VVALUE returns the value that is associated with the variable that you specify. VVALUEX, however, evaluates the argument to determine the variable name. The function then returns the value that is associated with that variable name.
  • VVALUE does not accept an expression as an argument. VVALUEX accepts expressions, but the value of the expression cannot denote an array reference.
  • VVALUE and an assignment statement both return a character string that contains the current value of the variable that you specify. With VVALUE, the value is formatted using the current format that is associated with the variable. With an assignment statement, however, the value is unformatted.
  • The PUT function allows you to reformat a specified variable or constant. VVALUE uses the current format that is associated with the variable.

Example

The following SAS statements produce this result.
SAS Statement
Result
y=9999;
format y comma10.2;
v=vvalue(y);
put v;
9,999.00

See Also

Functions:
Variable Information functions in SAS Functions and CALL Routines by Category