PERCENTNw.d Format

Produces percentages, using a minus sign for negative values.

Category: Numeric
Alignment: Right

Syntax

PERCENTNw.[d]

Arguments

w

specifies the width of the output field.

Default 6
Range 4–32

d

specifies the number of digits to the right of the decimal point in the numeric value.

Range 0–31
Requirement must be less than w

Details

The PERCENTNw.d format multiplies negative values by 100, formats them the same as the BESTw.d format, adds a minus sign to the beginning of the value, and adds a percent sign (%) to the end of the formatted value. The PERCENTNw.d format allows room for a percent sign and a minus sign, even if the value is not negative.

Comparisons

The PERCENTNw.d format produces percents by using a minus sign instead of parentheses for negative values. The PERCENTw.d format produces percents by using parentheses for negative values.

Example

Statements
Results
select put(-0.1,percentn10.);
      -10%
select put(.2,percentn10.);
       20%
select put(.8,percentn10.);
       80%
select put(-0.05,percentn10.);
       -5%
select put(-6.3,percentn10.);
     -630%

See Also

Last updated: February 23, 2017