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 />

WRITE FORMATS 1677<br />

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

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

commands. For more information, see “<strong>Command</strong> Order” on p. 8 in Volume I.<br />

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

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

• The new write 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 WRITE FORMATS or FORMATS command.<br />

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

resaved with the SAVE or XSAVE command.<br />

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

and write formats of F8.2 (or the format specified on the FORMAT subcommand of SET).<br />

The WRITE FORMATS command can be used to change the new variable’s write formats.<br />

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

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

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

• Date and time formats are effective only with the LIST and TABLES procedures and the<br />

PRINT and WRITE transformation commands. All other procedures use F format regardless<br />

of the date and time formats specified. See “Date and Time Formats” on p. 55 in<br />

Volume I.<br />

• If a numeric data value exceeds its width specification, the program attempts to write<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 written in the assigned<br />

width.<br />

WRITE FORMATS SALARY (DOLLAR8)<br />

/ HOURLY (DOLLAR7.2)<br />

/ RAISE BONUS (PCT2).<br />

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

dollar sign and comma when appropriate. An eight-digit number would require a DOLLAR11<br />

format specification: eight characters for the digits, two characters for commas, and one<br />

character for the dollar sign.<br />

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

dollar sign, decimal point, and two decimal places.<br />

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

for the percentage and one for the percent sign.

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

Saved successfully!

Ooh no, something went wrong!