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.
Note:This function supports the VARCHAR type.

Syntax

VVALUE(variable)

Required Argument

variable

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

RestrictionYou 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. However, VVALUEX evaluates the argument to determine the variable name, and 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. However, with an assignment statement, the value is unformatted.
  • The PUT function enables you to reformat a specified variable or constant. VVALUE uses the current format that is associated with the variable.

Example

data one;                                                                                                                               
   input val;                                                                                                                              
datalines;                                                                                                                              
9999                                                                                                                                    
1000.50                                                                                                                                 
;                                                                                                                                       
                                                                                                                                        
data new;                                                                                                                               
   set one;                                                                                                                               
   format val comma10.2;                                                                                                                  
   v=vvalue(val);                                                                                                                         
   put v;                                                                                                                                 
run; 

These statements produce these values:

9,999.00
1,000.50

See Also

Last updated: April 14, 2026