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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Operations<br />

Example<br />

PRINT FORMATS 1259<br />

• Unlike most transformations, PRINT FORMATS takes effect as soon as it is encountered in<br />

the command sequence. Special attention should be paid to its position among commands.<br />

• Variables not specified on PRINT FORMATS retain their current print formats in the working<br />

data file. To see the current formats, use the DISPLAY command.<br />

• The new print formats are changed only in the working file and are in effect for the duration<br />

of the session or until changed again with a PRINT FORMATS or FORMATS command.<br />

Print formats in the original data file (if one exists) are not changed, unless the file is resaved<br />

with the SAVE or XSAVE command.<br />

• New numeric variables created with transformation commands are assigned default print formats<br />

of F8.2 (or the format specified on the FORMAT subcommand of SET). The FORMATS<br />

command can be used to change the new variable’s print formats.<br />

• New string variables created with transformation commands are assigned the format<br />

specified on the STRING command that declares the variable. PRINT FORMATS cannot be<br />

used to change the format of a new string variable.<br />

• If a numeric data value exceeds its width specification, the program attempts to display<br />

some value nevertheless. First the program rounds decimal values, then removes punctuation<br />

characters, then tries scientific notation, and finally, if there is still not enough space,<br />

produces asterisks indicating that a value is present but cannot be displayed in the assigned<br />

width.<br />

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

/ RAISE BONUS (PCT2).<br />

• The print format for SALARY is changed to DOLLAR with eight positions, including the<br />

dollar sign and comma when appropriate. The value 11550 is displayed as $11,550. An<br />

eight-digit number would require a DOLLAR11 format specification: eight characters for<br />

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

• The print format for HOURLY is changed to DOLLAR with seven positions, including the<br />

dollar sign, decimal point, and two decimal places. The number 115 is displayed as<br />

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

the program would truncate the last 0 because a width of 6 is not enough to display the<br />

full value.<br />

• The print format for both RAISE and BONUS is changed to PCT with two positions: one<br />

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

9%. Because the width allows for only two positions, the value 10 displays as 10, since<br />

the percent sign is truncated.

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

Saved successfully!

Ooh no, something went wrong!