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.

1336 RECODE<br />

• SYSMIS specifies the system-missing value and can be used as both an original value and<br />

a new value.<br />

• See “<strong>Syntax</strong> Rules” above for a description of ELSE and COPY.<br />

String Variables<br />

• Keywords that can be used in the list of original values are CONVERT and ELSE. The only<br />

keyword that can be used in place of a new value is COPY. See p. 1338 for a description<br />

of CONVERT, and “<strong>Syntax</strong> Rules” on p. 1335 for a description of ELSE and COPY.<br />

• Both short and long string variables can be recoded.<br />

• Values must be enclosed in apostrophes or quotation marks.<br />

• Blanks are significant characters.<br />

Operations<br />

• Value specifications are scanned left to right.<br />

• A value is recoded only once per RECODE command.<br />

• Invalid specifications on a RECODE command that result in errors stop all processing of<br />

that RECODE command. No variables are recoded.<br />

Numeric Variables<br />

• Blank fields for numeric variables are handled according to the SET BLANKS specification<br />

prior to recoding.<br />

• When you recode a value that was previously defined as user-missing on the MISSING<br />

VALUE command, the new value is not missing.<br />

String Variables<br />

Example<br />

• If the original or new value specified is shorter than the format width defined for the variable,<br />

the string is right-padded with blanks.<br />

• If the original or recoded value specified is longer than the format width defined for that<br />

variable, the program issues an error message and RECODE is not executed.<br />

RECODE V1 TO V3 (0=1) (1=0) (2,3=-1) (9=9) (ELSE=SYSMIS)<br />

/QVAR(1 THRU 5=1)(6 THRU 10=2)(11 THRU HI=3)(ELSE=0).<br />

• The numeric variables between and including V1 and V3 are recoded: original values 0<br />

and 1 are switched respectively to 1 and 0; 2 and 3 are changed to −1; 9 remains 9; and<br />

any other value is changed to the system-missing value.

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

Saved successfully!

Ooh no, something went wrong!