Examples (WRITE FORMATS command)

Specifying Write Formats for Multiple Variables

WRITE FORMATS SALARY (DOLLAR8)
            / HOURLY (DOLLAR7.2)
            / RAISE BONUS (PCT2).
  • The write format for SALARY is changed to DOLLAR with eight positions, including the dollar sign and comma when appropriate. An eight-digit number would require a DOLLAR11 format specification: eight characters for the digits, two characters for commas, and one character for the dollar sign.
  • The write format for HOURLY is changed to DOLLAR with seven positions, including the dollar sign, decimal point, and two decimal places.
  • The write format for both RAISE and BONUS is changed to PCT with two positions: one for the percentage and one for the percent sign.

Changing the Default Format of a New Variable

COMPUTE V3=V1 + V2.
WRITE FORMATS V3 (F3.1).
  • COMPUTE creates the new numeric variable V3. By default, V3 is assigned an F8.2 format.
  • WRITE FORMATS changes the write format for V3 to F3.1.

Working With Custom Currency Formats

SET CCA='-/-.Dfl ..-'.
WRITE FORMATS COST (CCA14.2).
  • SET defines a European currency format for the custom currency format type CCA.
  • WRITE FORMATS assigns the write format CCA to variable COST. See the SET command for more information on custom currency formats.