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.

Variables<br />

To prepare data for processing, you must define variables by assigning variable names and<br />

formats. You can also specify variable labels, value labels, and missing values, but they are<br />

optional. This section discusses the two essential components of variable definition: variable<br />

names and formats.<br />

Variable Names<br />

Each variable must have a unique name. Variable names are stored in the dictionary of an<br />

SPSS-format data file or working data file. Observe the following rules when establishing<br />

variable names or referring to variables by their names on commands:<br />

• Variable names can be up to 64 bytes long, and the first character must be a letter or one<br />

of the characters @, #, or $. Subsequent characters can be any combination of letters,<br />

numbers, a period (.), and non-punctuation characters. 64 bytes typically means 64 characters<br />

in single-byte languages (e.g., English, French, German, Spanish, Italian, Hebrew,<br />

Russian, Greek, Arabic, Thai) and 32 characters in double-byte languages (e.g., Japanese,<br />

Chinese, Korean).<br />

(Note: “Letters” includes any non-punctuation characters used in writing ordinary words<br />

in the languages supported in the character set of the platform on which SPSS is running.)<br />

• Variable names cannot contain spaces.<br />

• A # character in the first position of a variable name defines a scratch variable (see<br />

“Scratch Variables” on p. 24).<br />

• A $ sign in the first position indicates that the variable is a system variable (see “System<br />

Variables” on p. 23). The $ sign is not allowed as the initial character of a user-defined<br />

variable.<br />

• The period, underscore, and the characters $, #, and @ can be used within variable<br />

names. For example, A._$@#1 is a valid variable name.<br />

• Variable names ending with a period should be avoided, since the period may be interpreted<br />

as a command terminator.<br />

• Variable names ending in underscores should be avoided, since such names may conflict<br />

with names of variables automatically created by a number of commands—for example,<br />

YEAR_ and DATE_ created by the DATE command.<br />

• Variable names can be established on the DATA LIST, KEYED DATA LIST, MATRIX DATA,<br />

NUMERIC, STRING, COMPUTE, RECODE, and COUNT commands. They can be changed<br />

with the RENAME VARIABLES command.<br />

• Reserved keywords cannot be used as variable names. Reserved keywords are<br />

ALL AND BY EQ GE GT LE<br />

LT NE NOT OR TO WITH<br />

21

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

Saved successfully!

Ooh no, something went wrong!