27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

596 FORMATS<br />

Example<br />

Example<br />

FORMATS SALARY (DOLLAR8) /HOURLY (DOLLAR7.2)<br />

/RAISE BONUS (PCT2).<br />

• The print and write formats for SALARY are changed to DOLLAR format with eight positions,<br />

including the dollar sign and comma when appropriate. The value 11550 is<br />

displayed as $11,550. An eight-digit number would require a DOLLAR11 format: eight<br />

characters for the digits, two characters for commas, and one character for the dollar sign.<br />

• The print and write formats for HOURLY are changed to DOLLAR format with seven positions,<br />

including the dollar sign, decimal point, and two decimal places. The value 115 is<br />

displayed as $115.00. If DOLLAR6.2 had been specified, the value 115 would be displayed<br />

as $115.0. The program would truncate the last 0 because a width of 6 is not enough to<br />

display the full value.<br />

• The print and write formats for both RAISE and BONUS are changed to PCT with two positions:<br />

one position for the percentage and one position for the percent sign. The value 9 is<br />

displayed as 9%. Since the width allows for only two positions, the value 10 is displayed<br />

as 10, since the percent sign is truncated.<br />

COMPUTE V3=V1 + V2.<br />

FORMATS V3 (F3.1).<br />

• COMPUTE creates the new numeric variable V3. By default, V3 is assigned an F8.2 format<br />

(or the default format specified on SET).<br />

• FORMATS changes both the print and write formats for V3 to F3.1.<br />

Example<br />

SET CCA=’-/-.Dfl ..-’.<br />

FORMATS COST (CCA14.2).<br />

• SET defines a European currency format for the custom currency format type CCA.<br />

• FORMATS assigns format CCA to variable COST. With the format defined for CCA on<br />

SET, the value 37419 is displayed as Dfl 37.419,00. See the SET command for more<br />

information on custom currency formats.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!