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.

Format<br />

type<br />

26 Universals<br />

• Output formats (widths) for string variables cannot be changed with command syntax.<br />

However, you can use STRING to declare a new variable with the desired format and then<br />

use COMPUTE to copy values from the existing string variable into the new variable.<br />

• The format type cannot be changed from string to numeric, or vice versa, with command<br />

syntax. However, you can use RECODE to recode values from one variable into another<br />

variable of a different type.<br />

See DATA LIST for information on specifying input data formats. See FORMATS, PRINT<br />

FORMATS, and WRITE FORMATS for information on specifying output data formats. See<br />

STRING for information on declaring new string variables.<br />

Numeric Variable Formats<br />

• The formats used in this manual use FORTRAN-like syntax—for example, Fw.d, where<br />

F denotes the format type (numeric), w represents the variable width, and d represents the<br />

number of decimal places.<br />

• By default, the DATA LIST and KEYED DATA LIST commands assume that variables are<br />

numeric with an F format type. The default width depends on whether the data are in fixed<br />

or freefield format. For discussion of fixed data and freefield data, see DATA LIST.<br />

• Numeric variables created by COMPUTE, COUNT, or other commands that create numeric<br />

variables are assigned a format type F8.2 (or the default format defined on SET FORMAT).<br />

• If a data value exceeds its width specification, SPSS makes an attempt to display some<br />

value nevertheless. It first rounds the decimals, then takes out punctuation characters,<br />

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

(***), indicating that a value is present but cannot be displayed in the assigned width.<br />

• The output format does not affect the value stored in the file. A numeric value is always<br />

stored in double precision.<br />

F, N, and E Formats<br />

Table 3 lists the formats most commonly used to read in and write out numeric data.<br />

Table 3 Common numeric formats<br />

Description<br />

Fw.d Standard<br />

numeric<br />

Nw.d Restricted<br />

numeric<br />

Sample<br />

format<br />

Sample<br />

input<br />

Output for fixed input Output for freefield input<br />

Format Value Format Value<br />

F5.0 1234 F5.0 1234 F5.0 1234<br />

1.234 1 1 *<br />

F5.2 1234 F6.2 12.34 F6.2 1234.0<br />

1.234 1.23 1.23<br />

N5.0 00123 F5.0 123 F5.0 123<br />

1.234 . † 1

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

Saved successfully!

Ooh no, something went wrong!