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.

164 AUTORECODE<br />

Example<br />

Example<br />

DATA LIST / COMPANY 1-21 (A) SALES 24-28.<br />

BEGIN DATA<br />

CATFOOD JOY 10000<br />

OLD FASHIONED CATFOOD 11200<br />

. . .<br />

PRIME CATFOOD 10900<br />

CHOICE CATFOOD 14600<br />

END DATA.<br />

AUTORECODE VARIABLES=COMPANY /INTO=RCOMPANY /PRINT.<br />

TABLES TABLE = SALES BY RCOMPANY<br />

/TTITLE=’CATFOOD SALES BY COMPANY’.<br />

• Because TABLES truncates string variables to eight characters, AUTORECODE is used to<br />

recode the string variable COMPANY, which contains the names of various hypothetical<br />

cat food companies.<br />

• AUTORECODE recodes COMPANY into a numeric variable RCOMPANY. Values of<br />

RCOMPANY are consecutive integers beginning with 1 and ending with the number of<br />

different values entered for COMPANY. The values of COMPANY are used as value<br />

labels for RCOMPANY’s numeric values. The PRINT subcommand displays a table of<br />

the original and recoded values.<br />

• The variable RCOMPANY is used as the banner variable in the TABLES procedure to<br />

produce a table of sales figures for each cat food company. The value labels for<br />

RCOMPANY are used as column headings. Since TABLES does not truncate value labels,<br />

the full company names appear.<br />

AUTORECODE VARIABLES=REGION /INTO=RREGION /PRINT.<br />

ANOVA Y BY RREGION (1,5).<br />

• In statistical procedures, empty cells can reduce performance and increase memory<br />

requirements. In this example, assume that the factor REGION has only five nonempty<br />

categories, represented by the numeric codes 1, 4, 6, 14, and 20. AUTORECODE recodes<br />

those values into 1, 2, 3, 4, and 5 for target variable RREGION.<br />

• The variable RREGION is used in ANOVA. If the original variable REGION were used, the<br />

amount of memory required by ANOVA would be 4429 bytes. Using variable RREGION,<br />

ANOVA requires only 449 bytes of memory.

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

Saved successfully!

Ooh no, something went wrong!