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.

34 Universals<br />

• The output format for a string variable is always A. The width is determined by the input<br />

format or the format assigned on the STRING command. String formats can be displayed<br />

with DISPLAY VARIABLES but cannot be changed.<br />

Aw (Standard Characters)<br />

The A format is used to read standard characters. Characters can include letters, numbers,<br />

punctuation marks, blanks, and most other characters on your keyboard. Numbers entered as<br />

values for string variables cannot be used in calculations unless you convert them to numeric<br />

format with the NUMBER function (see “String Functions” on p. 45).<br />

Fixed data:<br />

With fixed-format input data, any punctuation—including leading, trailing, and embedded<br />

blanks—within the column specifications is included in the string value. For example, a string<br />

value of “Mr. Ed” (with one embedded blank) is distinguished from a value of “Mr. Ed”<br />

(with two embedded blanks). It is also distinguished from a string value of “MR. ED” (all<br />

upper case), and all three are treated as separate values. These can be important considerations<br />

for any procedures, transformations, or data selection commands involving string variables.<br />

Consider the following example:<br />

DATA LIST FIXED /ALPHAVAR 1-10 (A).<br />

BEGIN DATA<br />

Mr. Ed<br />

Mr. Ed<br />

MR. ED<br />

Mr. Ed<br />

Mr. Ed<br />

END DATA.<br />

AUTORECODE ALPHAVAR /INTO NUMVAR.<br />

LIST.<br />

AUTORECODE recodes the values into consecutive integers. Figure 12 shows the recoded<br />

values.<br />

Figure 12 Different string values illustrated<br />

ALPHAVAR NUMVAR<br />

Mr. Ed 4<br />

Mr. Ed 4<br />

MR. ED 2<br />

Mr. Ed 3<br />

Mr. Ed 1<br />

Freefield data:<br />

With freefield data, blanks and commas are treated as delimiters for A format variables unless<br />

the value is enclosed in apostrophes or quotation marks. For example,<br />

Ed, Mr.

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

Saved successfully!

Ooh no, something went wrong!